diff --git a/package.json b/package.json index ad55687..3d9a0b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@barchart/common-js", - "version": "4.17.1", + "version": "4.18.0", "description": "Library of common JavaScript utilities", "author": { "name": "Bryan Ingle", diff --git a/test/SpecRunner.js b/test/SpecRunner.js index 6080690..c591634 100644 --- a/test/SpecRunner.js +++ b/test/SpecRunner.js @@ -16215,7 +16215,7 @@ module.exports = (() => { return Specification.And; })(); -},{"./Specification":74}],63:[function(require,module,exports){ +},{"./Specification":76}],63:[function(require,module,exports){ const assert = require('./../lang/assert'); const Specification = require('./Specification'); @@ -16252,7 +16252,7 @@ module.exports = (() => { return Between; })(); -},{"./../lang/assert":30,"./Specification":74}],64:[function(require,module,exports){ +},{"./../lang/assert":30,"./Specification":76}],64:[function(require,module,exports){ const is = require('./../lang/is'); const Specification = require('./Specification'); @@ -16297,7 +16297,7 @@ module.exports = (() => { return Changes; })(); -},{"./../lang/is":36,"./Specification":74}],65:[function(require,module,exports){ +},{"./../lang/is":36,"./Specification":76}],65:[function(require,module,exports){ const assert = require('./../lang/assert'); const Specification = require('./Specification'); @@ -16333,7 +16333,7 @@ module.exports = (() => { return Contained; })(); -},{"./../lang/assert":30,"./Specification":74}],66:[function(require,module,exports){ +},{"./../lang/assert":30,"./Specification":76}],66:[function(require,module,exports){ const Specification = require('./Specification'); module.exports = (() => { @@ -16366,7 +16366,58 @@ module.exports = (() => { return Contains; })(); -},{"./Specification":74}],67:[function(require,module,exports){ +},{"./Specification":76}],67:[function(require,module,exports){ +const assert = require('./../lang/assert'); + +is = require('./../lang/is'); + +const Specification = require('./Specification'); + +module.exports = (() => { + 'use strict'; + /** + * A stateful {@link Specification} that passes when the value of the data item + * crosses a value passed to the constructor. The specification will never pass + * on the first evaluation. Instead, the first data item is used to determine + * if the value is currently greater than (or less than) the threshold value + * (passed to the constructor). This determines if the passing condition means + * the value must be less than (or greater than) the threshold. + * + * @public + * @extends {Specification} + * @param {Number} threshold + */ + + class CrossesSpecification extends Specification { + constructor(threshold) { + super(); + assert.argumentIsRequired(threshold, 'threshold', Number); + this._threshold = threshold; + this._previous = null; + } + + _evaluate(data) { + if (!is.number(data)) { + return false; + } + + const current = data; + const previous = this._previous; + const crossed = previous !== null && (previous > this._threshold && !(current > this._threshold) || previous < this._threshold && !(current < this._threshold)); + this._previous = current; + return crossed; + } + + toString() { + return '[CrossesSpecification]'; + } + + } + + return CrossesSpecification; +})(); + +},{"./../lang/assert":30,"./../lang/is":36,"./Specification":76}],68:[function(require,module,exports){ const Specification = require('./Specification'); module.exports = (() => { @@ -16399,7 +16450,7 @@ module.exports = (() => { return Equals; })(); -},{"./Specification":74}],68:[function(require,module,exports){ +},{"./Specification":76}],69:[function(require,module,exports){ const Specification = require('./Specification'); module.exports = (() => { @@ -16429,7 +16480,7 @@ module.exports = (() => { return Fail; })(); -},{"./Specification":74}],69:[function(require,module,exports){ +},{"./Specification":76}],70:[function(require,module,exports){ const is = require('./../lang/is'); const Specification = require('./Specification'); @@ -16461,7 +16512,7 @@ module.exports = (() => { return Nan; })(); -},{"./../lang/is":36,"./Specification":74}],70:[function(require,module,exports){ +},{"./../lang/is":36,"./Specification":76}],71:[function(require,module,exports){ const Specification = require('./Specification'); module.exports = (() => { @@ -16470,7 +16521,39 @@ module.exports = (() => { return Specification.Not; })(); -},{"./Specification":74}],71:[function(require,module,exports){ +},{"./Specification":76}],72:[function(require,module,exports){ +const is = require('./../lang/is'); + +const Specification = require('./Specification'); + +module.exports = (() => { + 'use strict'; + /** + * A {@link Specification} that passes when a data item is a null value. + * + * @public + * @extends {Specification} + */ + + class Null extends Specification { + constructor() { + super(); + } + + _evaluate(data) { + return is.null(data); + } + + toString() { + return '[Null]'; + } + + } + + return Null; +})(); + +},{"./../lang/is":36,"./Specification":76}],73:[function(require,module,exports){ const is = require('./../lang/is'); const Specification = require('./Specification'); @@ -16504,7 +16587,7 @@ module.exports = (() => { return Numeric; })(); -},{"./../lang/is":36,"./Specification":74}],72:[function(require,module,exports){ +},{"./../lang/is":36,"./Specification":76}],74:[function(require,module,exports){ const Specification = require('./Specification'); module.exports = (() => { @@ -16513,7 +16596,7 @@ module.exports = (() => { return Specification.Or; })(); -},{"./Specification":74}],73:[function(require,module,exports){ +},{"./Specification":76}],75:[function(require,module,exports){ const Specification = require('./Specification'); module.exports = (() => { @@ -16543,7 +16626,7 @@ module.exports = (() => { return Pass; })(); -},{"./Specification":74}],74:[function(require,module,exports){ +},{"./Specification":76}],76:[function(require,module,exports){ const assert = require('./../lang/assert'); module.exports = (() => { @@ -16688,7 +16771,39 @@ module.exports = (() => { return Specification; })(); -},{"./../lang/assert":30}],75:[function(require,module,exports){ +},{"./../lang/assert":30}],77:[function(require,module,exports){ +const is = require('./../lang/is'); + +const Specification = require('./Specification'); + +module.exports = (() => { + 'use strict'; + /** + * A {@link Specification} that passes when a data item is an undefined value. + * + * @public + * @extends {Specification} + */ + + class Undefined extends Specification { + constructor() { + super(); + } + + _evaluate(data) { + return is.undefined(data); + } + + toString() { + return '[Undefined]'; + } + + } + + return Undefined; +})(); + +},{"./../lang/is":36,"./Specification":76}],78:[function(require,module,exports){ const is = require('./../../lang/is'); const Specification = require('./../Specification'); @@ -16721,7 +16836,7 @@ module.exports = (() => { return After; })(); -},{"./../../lang/is":36,"./../Specification":74}],76:[function(require,module,exports){ +},{"./../../lang/is":36,"./../Specification":76}],79:[function(require,module,exports){ const is = require('./../../lang/is'); const Specification = require('./../Specification'); @@ -16754,7 +16869,7 @@ module.exports = (() => { return Before; })(); -},{"./../../lang/is":36,"./../Specification":74}],77:[function(require,module,exports){ +},{"./../../lang/is":36,"./../Specification":76}],80:[function(require,module,exports){ const is = require('./../../lang/is'), DayClazz = require('./../../lang/Day'); @@ -16785,7 +16900,7 @@ module.exports = (() => { return Day; })(); -},{"./../../lang/Day":21,"./../../lang/is":36,"./../Specification":74}],78:[function(require,module,exports){ +},{"./../../lang/Day":21,"./../../lang/is":36,"./../Specification":76}],81:[function(require,module,exports){ const is = require('./../../lang/is'); const Specification = require('./../Specification'); @@ -16818,7 +16933,7 @@ module.exports = (() => { return GreaterThan; })(); -},{"./../../lang/is":36,"./../Specification":74}],79:[function(require,module,exports){ +},{"./../../lang/is":36,"./../Specification":76}],82:[function(require,module,exports){ const is = require('./../../lang/is'); const Specification = require('./../Specification'); @@ -16851,7 +16966,7 @@ module.exports = (() => { return LessThan; })(); -},{"./../../lang/is":36,"./../Specification":74}],80:[function(require,module,exports){ +},{"./../../lang/is":36,"./../Specification":76}],83:[function(require,module,exports){ const is = require('./../../lang/is'); const Specification = require('./../Specification'); @@ -16881,7 +16996,7 @@ module.exports = (() => { return Numeric; })(); -},{"./../../lang/is":36,"./../Specification":74}],81:[function(require,module,exports){ +},{"./../../lang/is":36,"./../Specification":76}],84:[function(require,module,exports){ const is = require('./../../lang/is'); const Specification = require('./../Specification'); @@ -16914,7 +17029,7 @@ module.exports = (() => { return SameDay; })(); -},{"./../../lang/is":36,"./../Specification":74}],82:[function(require,module,exports){ +},{"./../../lang/is":36,"./../Specification":76}],85:[function(require,module,exports){ const Enum = require('./../../../../lang/Enum'), FailureReasonItem = require('./../../../../api/failures/FailureReasonItem'), FailureType = require('./../../../../api/failures/FailureType'); @@ -17020,7 +17135,7 @@ describe('When a FailureType is created with a template string that references d }); }); -},{"./../../../../api/failures/FailureReasonItem":2,"./../../../../api/failures/FailureType":3,"./../../../../lang/Enum":24}],83:[function(require,module,exports){ +},{"./../../../../api/failures/FailureReasonItem":2,"./../../../../api/failures/FailureType":3,"./../../../../lang/Enum":24}],86:[function(require,module,exports){ const Enum = require('./../../../../lang/Enum'); const FailureReason = require('./../../../../api/failures/FailureReason'), @@ -17197,7 +17312,7 @@ describe('When a schema is validated', () => { }); }); -},{"./../../../../api/failures/FailureReason":1,"./../../../../api/failures/FailureType":3,"./../../../../lang/Enum":24,"./../../../../serialization/json/DataType":57,"./../../../../serialization/json/Field":58,"./../../../../serialization/json/Schema":59}],84:[function(require,module,exports){ +},{"./../../../../api/failures/FailureReason":1,"./../../../../api/failures/FailureType":3,"./../../../../lang/Enum":24,"./../../../../serialization/json/DataType":57,"./../../../../serialization/json/Field":58,"./../../../../serialization/json/Schema":59}],87:[function(require,module,exports){ const LinkedList = require('./../../../collections/LinkedList'); describe('When "doe" is used to start a linked list', () => { @@ -17257,7 +17372,7 @@ describe('When "doe" is used to start a linked list', () => { }); }); -},{"./../../../collections/LinkedList":4}],85:[function(require,module,exports){ +},{"./../../../collections/LinkedList":4}],88:[function(require,module,exports){ const Queue = require('./../../../collections/Queue'); describe('When a Queue is constructed', () => { @@ -17387,7 +17502,7 @@ describe('When a Queue is constructed', () => { }); }); -},{"./../../../collections/Queue":5}],86:[function(require,module,exports){ +},{"./../../../collections/Queue":5}],89:[function(require,module,exports){ const Stack = require('./../../../collections/Stack'); describe('When a Stack is constructed', () => { @@ -17514,7 +17629,7 @@ describe('When a Stack is constructed', () => { }); }); -},{"./../../../collections/Stack":6}],87:[function(require,module,exports){ +},{"./../../../collections/Stack":6}],90:[function(require,module,exports){ const Tree = require('./../../../collections/Tree'); describe('When a Tree is constructed', () => { @@ -17631,7 +17746,7 @@ describe('When a Tree is constructed', () => { }); }); -},{"./../../../collections/Tree":7}],88:[function(require,module,exports){ +},{"./../../../collections/Tree":7}],91:[function(require,module,exports){ const ComparatorBuilder = require('./../../../../collections/sorting/ComparatorBuilder'); describe('When a ComparatorBuilder is composed with two comparators', () => { @@ -17713,7 +17828,7 @@ describe('When a ComparatorBuilder is composed with two comparators', () => { }); }); -},{"./../../../../collections/sorting/ComparatorBuilder":8}],89:[function(require,module,exports){ +},{"./../../../../collections/sorting/ComparatorBuilder":8}],92:[function(require,module,exports){ const comparators = require('./../../../../collections/sorting/comparators'); describe('When using the "compareDates" comparator', () => { @@ -17897,7 +18012,7 @@ describe('When using the "compareNull" comparator', () => { }); }); -},{"./../../../../collections/sorting/comparators":9}],90:[function(require,module,exports){ +},{"./../../../../collections/sorting/comparators":9}],93:[function(require,module,exports){ const CompoundMap = require('./../../../../collections/specialized/CompoundMap'); describe('When an CompoundMap is constructed', () => { @@ -18032,7 +18147,7 @@ describe('When an CompoundMap is constructed', () => { }); }); -},{"./../../../../collections/specialized/CompoundMap":10}],91:[function(require,module,exports){ +},{"./../../../../collections/specialized/CompoundMap":10}],94:[function(require,module,exports){ const Disposable = require('./../../../../lang/Disposable'), DisposableStack = require('./../../../../collections/specialized/DisposableStack'); @@ -18195,7 +18310,7 @@ describe('When an DisposableStack is constructed', () => { }); }); -},{"./../../../../collections/specialized/DisposableStack":11,"./../../../../lang/Disposable":23}],92:[function(require,module,exports){ +},{"./../../../../collections/specialized/DisposableStack":11,"./../../../../lang/Disposable":23}],95:[function(require,module,exports){ const EvictingList = require('./../../../../collections/specialized/EvictingList'); describe('When an EvictingList is constructed (with no capacity)', () => { @@ -18368,7 +18483,7 @@ describe('When an EvictingList is constructed (with a capacity of 3)', () => { }); }); -},{"./../../../../collections/specialized/EvictingList":12}],93:[function(require,module,exports){ +},{"./../../../../collections/specialized/EvictingList":12}],96:[function(require,module,exports){ const EvictingMap = require('./../../../../collections/specialized/EvictingMap'); describe('When an EvictingMap is constructed (with no capacity)', () => { @@ -18662,7 +18777,7 @@ describe('When an EvictingMap is constructed', () => { }); }); -},{"./../../../../collections/specialized/EvictingMap":13}],94:[function(require,module,exports){ +},{"./../../../../collections/specialized/EvictingMap":13}],97:[function(require,module,exports){ const PriorityQueue = require('./../../../../collections/specialized/PriorityQueue'); describe('When a Queue is constructed, using a "ladies first" comparator', () => { @@ -18942,7 +19057,7 @@ describe('When a Queue is constructed, using a simple (ascending) numeric compar }); }); -},{"./../../../../collections/specialized/PriorityQueue":14}],95:[function(require,module,exports){ +},{"./../../../../collections/specialized/PriorityQueue":14}],98:[function(require,module,exports){ const TimeMap = require('./../../../../collections/specialized/TimeMap'); describe('When an TimeMap is constructed (with a 10 millisecond time to live)', () => { @@ -18980,7 +19095,7 @@ describe('When an TimeMap is constructed (with a 10 millisecond time to live)', }); }); -},{"./../../../../collections/specialized/TimeMap":15}],96:[function(require,module,exports){ +},{"./../../../../collections/specialized/TimeMap":15}],99:[function(require,module,exports){ const CommandHandler = require('./../../../commands/CommandHandler'); describe('When a CommandHandler is created from a function', () => { @@ -19032,7 +19147,7 @@ describe('When a CommandHandler is created from a function', () => { }); }); -},{"./../../../commands/CommandHandler":16}],97:[function(require,module,exports){ +},{"./../../../commands/CommandHandler":16}],100:[function(require,module,exports){ const CommandHandler = require('./../../../commands/CommandHandler'), CompositeCommandHandler = require('./../../../commands/CompositeCommandHandler'); @@ -19081,7 +19196,7 @@ describe('When a CompositeCommandHandler is created', () => { }); }); -},{"./../../../commands/CommandHandler":16,"./../../../commands/CompositeCommandHandler":17}],98:[function(require,module,exports){ +},{"./../../../commands/CommandHandler":16,"./../../../commands/CompositeCommandHandler":17}],101:[function(require,module,exports){ const CommandHandler = require('./../../../commands/CommandHandler'), MappedCommandHandler = require('./../../../commands/MappedCommandHandler'); @@ -19148,7 +19263,7 @@ describe('When a MappedCommandHandler is created with two mapped commands', () = }); }); -},{"./../../../commands/CommandHandler":16,"./../../../commands/MappedCommandHandler":18}],99:[function(require,module,exports){ +},{"./../../../commands/CommandHandler":16,"./../../../commands/MappedCommandHandler":18}],102:[function(require,module,exports){ const AdHoc = require('./../../../lang/AdHoc'); describe('When wrapping an object in an ad hoc serialization container', () => { @@ -19189,7 +19304,7 @@ describe('When wrapping an object in an ad hoc serialization container', () => { }); }); -},{"./../../../lang/AdHoc":19}],100:[function(require,module,exports){ +},{"./../../../lang/AdHoc":19}],103:[function(require,module,exports){ const Day = require('./../../../lang/Day'); describe('When "2017-08-31 is parsed as a Day', () => { @@ -19660,7 +19775,7 @@ describe('When getting end of the month', () => { }); }); -},{"./../../../lang/Day":21}],101:[function(require,module,exports){ +},{"./../../../lang/Day":21}],104:[function(require,module,exports){ const Decimal = require('./../../../lang/Decimal'); describe('When adding values that cause floating point problems (e.g. 1.1 + 2.2 != 3.3)', () => { @@ -20012,7 +20127,7 @@ describe('When cloning a decimal', () => { }); }); -},{"./../../../lang/Decimal":22}],102:[function(require,module,exports){ +},{"./../../../lang/Decimal":22}],105:[function(require,module,exports){ const Disposable = require('./../../../lang/Disposable'); describe('When a Disposable is extended', () => { @@ -20108,7 +20223,7 @@ describe('When a Disposable.fromAction creates a Disposable', () => { }); }); -},{"./../../../lang/Disposable":23}],103:[function(require,module,exports){ +},{"./../../../lang/Disposable":23}],106:[function(require,module,exports){ const Enum = require('./../../../lang/Enum'); describe('When Enum is extended (as types EnumA and EnumB) and type items are added to each (X and Y)', () => { @@ -20155,7 +20270,7 @@ describe('When Enum is extended (as types EnumA and EnumB) and type items are ad }); }); -},{"./../../../lang/Enum":24}],104:[function(require,module,exports){ +},{"./../../../lang/Enum":24}],107:[function(require,module,exports){ const Currency = require('./../../../lang/Currency'), Decimal = require('./../../../lang/Decimal'), Rate = require('./../../../lang/Rate'); @@ -20227,7 +20342,7 @@ describe('When parsing an "^USDEUR" rate of 0.8333', () => { }); }); -},{"./../../../lang/Currency":20,"./../../../lang/Decimal":22,"./../../../lang/Rate":26}],105:[function(require,module,exports){ +},{"./../../../lang/Currency":20,"./../../../lang/Decimal":22,"./../../../lang/Rate":26}],108:[function(require,module,exports){ const Timestamp = require('./../../../lang/Timestamp'); describe('When Timestamp is created from a timestamp (1502372574350)', () => { @@ -20383,7 +20498,7 @@ describe('When comparing the same Timestamp instances', () => { }); }); -},{"./../../../lang/Timestamp":27}],106:[function(require,module,exports){ +},{"./../../../lang/Timestamp":27}],109:[function(require,module,exports){ let Timezones = require('./../../../lang/Timezones'); describe('When accessing static items', () => { @@ -20473,7 +20588,7 @@ describe('When attempting to determine if daylight savings time is in effect', ( }); }); -},{"./../../../lang/Timezones":28}],107:[function(require,module,exports){ +},{"./../../../lang/Timezones":28}],110:[function(require,module,exports){ const array = require('./../../../lang/array'); describe('when reducing an array to unique values', () => { @@ -21606,7 +21721,7 @@ describe('when performing a binary search on an array with twenty one sparse ite }); }); -},{"./../../../lang/array":29}],108:[function(require,module,exports){ +},{"./../../../lang/array":29}],111:[function(require,module,exports){ const attributes = require('./../../../lang/attributes'); describe('When "attributes.has" is used to check a top-level property', () => { @@ -22162,7 +22277,7 @@ describe('When "attributes.read" is used with a non-default separator', () => { }); }); -},{"./../../../lang/attributes":31}],109:[function(require,module,exports){ +},{"./../../../lang/attributes":31}],112:[function(require,module,exports){ const connection = require('./../../../lang/connection'); describe('When "getIsSecure is invoked', () => { @@ -22182,7 +22297,7 @@ describe('When "getIsSecure is invoked', () => { }); }); -},{"./../../../lang/connection":32}],110:[function(require,module,exports){ +},{"./../../../lang/connection":32}],113:[function(require,module,exports){ const utilities = require('./../../../lang/date'); describe('When extracting the "short" day of week', () => { @@ -22292,7 +22407,7 @@ describe('When determining the ordinal for a date', () => { }); }); -},{"./../../../lang/date":33}],111:[function(require,module,exports){ +},{"./../../../lang/date":33}],114:[function(require,module,exports){ const formatter = require('./../../../lang/formatter'); describe('When formatting numbers', () => { @@ -22303,7 +22418,7 @@ describe('When formatting numbers', () => { }); }); -},{"./../../../lang/formatter":34}],112:[function(require,module,exports){ +},{"./../../../lang/formatter":34}],115:[function(require,module,exports){ const functions = require('./../../../lang/functions'); describe('when using the tautology function', () => { @@ -22328,7 +22443,7 @@ describe('when using the tautology function', () => { }); }); -},{"./../../../lang/functions":35}],113:[function(require,module,exports){ +},{"./../../../lang/functions":35}],116:[function(require,module,exports){ const is = require('./../../../lang/is'); describe('When checking the number 3', () => { @@ -23052,7 +23167,7 @@ describe('When checking inheritance', () => { }); }); -},{"./../../../lang/is":36}],114:[function(require,module,exports){ +},{"./../../../lang/is":36}],117:[function(require,module,exports){ const iterate = require('./../../../lang/iterate'); describe('When using the iterate function', () => { @@ -23171,7 +23286,7 @@ describe('When using the iterate function', () => { }); }); -},{"./../../../lang/iterate":37}],115:[function(require,module,exports){ +},{"./../../../lang/iterate":37}],118:[function(require,module,exports){ const mask = require('./../../../lang/mask'); describe('When testing the suitability of an bit-based enumeration item', () => { @@ -23290,7 +23405,7 @@ describe('When working with an empty flags collection', () => { }); }); -},{"./../../../lang/mask":38}],116:[function(require,module,exports){ +},{"./../../../lang/mask":38}],119:[function(require,module,exports){ const math = require('./../../../lang/math'); describe('When using math.approximate', () => { @@ -23343,7 +23458,7 @@ describe('When using math.approximate', () => { }); }); -},{"./../../../lang/math":39}],117:[function(require,module,exports){ +},{"./../../../lang/math":39}],120:[function(require,module,exports){ const memoize = require('./../../../lang/memoize'); describe('When using memoize.simple', () => { @@ -23471,7 +23586,7 @@ describe('When using memoize.cache', () => { }); }); -},{"./../../../lang/memoize":40}],118:[function(require,module,exports){ +},{"./../../../lang/memoize":40}],121:[function(require,module,exports){ const object = require('./../../../lang/object'); describe('When cloning an object', () => { @@ -23807,7 +23922,7 @@ describe('When cloning a complex object (using a custom value extractor)', () => }); }); -},{"./../../../lang/object":41}],119:[function(require,module,exports){ +},{"./../../../lang/object":41}],122:[function(require,module,exports){ const promise = require('./../../../lang/promise'); describe('When a timeout is set for a promise', () => { @@ -24677,7 +24792,7 @@ describe('When "promise.build" is used to create a promise', () => { }); }); -},{"./../../../lang/promise":42}],120:[function(require,module,exports){ +},{"./../../../lang/promise":42}],123:[function(require,module,exports){ const random = require('./../../../lang/random'); describe('When generating a random number, restricting the range to one integer', () => { @@ -24739,7 +24854,7 @@ describe('When generating a random number using an invalid range, the range is a }); }); -},{"./../../../lang/random":43}],121:[function(require,module,exports){ +},{"./../../../lang/random":43}],124:[function(require,module,exports){ const string = require('./../../../lang/string'); describe('When converting a sentence to "start" casing', () => { @@ -24908,7 +25023,7 @@ describe('When a formattable string ("&startDate={0}&endDate={1}"', () => { }); }); -},{"./../../../lang/string":44}],122:[function(require,module,exports){ +},{"./../../../lang/string":44}],125:[function(require,module,exports){ const EventMap = require('./../../../messaging/EventMap'); describe('When an EventMap is constructed', () => { @@ -25045,7 +25160,7 @@ describe('When an EventMap is constructed', () => { }); }); -},{"./../../../messaging/EventMap":47}],123:[function(require,module,exports){ +},{"./../../../messaging/EventMap":47}],126:[function(require,module,exports){ const Disposable = require('./../../../lang/Disposable'), Event = require('./../../../messaging/Event'); @@ -25188,7 +25303,7 @@ describe('When an Event is constructed', () => { }); }); -},{"./../../../lang/Disposable":23,"./../../../messaging/Event":46}],124:[function(require,module,exports){ +},{"./../../../lang/Disposable":23,"./../../../messaging/Event":46}],127:[function(require,module,exports){ const Disposable = require('./../../../lang/Disposable'), Model = require('./../../../models/Model'); @@ -25291,7 +25406,7 @@ describe('When an Model is constructed with "firstName" and "lastName" propertie }); }); -},{"./../../../lang/Disposable":23,"./../../../models/Model":48}],125:[function(require,module,exports){ +},{"./../../../lang/Disposable":23,"./../../../models/Model":48}],128:[function(require,module,exports){ const RestParser = require('./../../../../network/rest/RestParser'); describe('Using a customized JSON REST parser is created', () => { @@ -25368,7 +25483,7 @@ describe('Using another customized JSON REST parser is created', () => { }); }); -},{"./../../../../network/rest/RestParser":49}],126:[function(require,module,exports){ +},{"./../../../../network/rest/RestParser":49}],129:[function(require,module,exports){ const AdHoc = require('./../../../../lang/AdHoc'), Currency = require('./../../../../lang/Currency'), Day = require('./../../../../lang/Day'), @@ -26145,7 +26260,7 @@ describe('When a schema is created with only two days', () => { }); }); -},{"./../../../../lang/AdHoc":19,"./../../../../lang/Currency":20,"./../../../../lang/Day":21,"./../../../../lang/Decimal":22,"./../../../../lang/Enum":24,"./../../../../lang/Money":25,"./../../../../serialization/json/Component":56,"./../../../../serialization/json/DataType":57,"./../../../../serialization/json/Field":58,"./../../../../serialization/json/Schema":59}],127:[function(require,module,exports){ +},{"./../../../../lang/AdHoc":19,"./../../../../lang/Currency":20,"./../../../../lang/Day":21,"./../../../../lang/Decimal":22,"./../../../../lang/Enum":24,"./../../../../lang/Money":25,"./../../../../serialization/json/Component":56,"./../../../../serialization/json/DataType":57,"./../../../../serialization/json/Field":58,"./../../../../serialization/json/Schema":59}],130:[function(require,module,exports){ const Component = require('./../../../../../serialization/json/Component'), DataType = require('./../../../../../serialization/json/DataType'), SchemaBuilder = require('./../../../../../serialization/json/builders/SchemaBuilder'); @@ -26268,7 +26383,7 @@ describe('When using the schema builder to create a "Person" schema', () => { }); }); -},{"./../../../../../serialization/json/Component":56,"./../../../../../serialization/json/DataType":57,"./../../../../../serialization/json/builders/SchemaBuilder":61}],128:[function(require,module,exports){ +},{"./../../../../../serialization/json/Component":56,"./../../../../../serialization/json/DataType":57,"./../../../../../serialization/json/builders/SchemaBuilder":61}],131:[function(require,module,exports){ const Specification = require('./../../../specifications/Specification'), And = require('./../../../specifications/And'); @@ -26341,7 +26456,7 @@ describe('When an And specification is constructed', () => { }); }); -},{"./../../../specifications/And":62,"./../../../specifications/Specification":74}],129:[function(require,module,exports){ +},{"./../../../specifications/And":62,"./../../../specifications/Specification":76}],132:[function(require,module,exports){ const Between = require('./../../../specifications/Between'); describe('When a Between specification is constructed (with a range of 17 to 42)', () => { @@ -26371,7 +26486,7 @@ describe('When a Between specification is constructed (with a range of 17 to 42) }); }); -},{"./../../../specifications/Between":63}],130:[function(require,module,exports){ +},{"./../../../specifications/Between":63}],133:[function(require,module,exports){ const Changes = require('./../../../specifications/Changes'); describe('When a Changes specification is used to evaluate strings', () => { @@ -26441,7 +26556,7 @@ describe('When a Changes specification is used to evaluate numbers', () => { }); }); -},{"./../../../specifications/Changes":64}],131:[function(require,module,exports){ +},{"./../../../specifications/Changes":64}],134:[function(require,module,exports){ const Contained = require('./../../../specifications/Contained'); describe('When a Contained specifciation is constructed', () => { @@ -26490,7 +26605,7 @@ describe('When a Contained specifciation is constructed', () => { }); }); -},{"./../../../specifications/Contained":65}],132:[function(require,module,exports){ +},{"./../../../specifications/Contained":65}],135:[function(require,module,exports){ const Contains = require('./../../../specifications/Contains'); describe('When a Contains specification is constructed', () => { @@ -26533,7 +26648,153 @@ describe('When a Contains specification is constructed', () => { }); }); -},{"./../../../specifications/Contains":66}],133:[function(require,module,exports){ +},{"./../../../specifications/Contains":66}],136:[function(require,module,exports){ +const Crosses = require('./../../../specifications/Crosses'); + +describe('When a Crosses specification is initialized with a threshold of 1000', () => { + 'use strict'; + + let specification; + beforeEach(() => { + specification = new Crosses(1000); + }); + describe('and the first value evaluated is 900', () => { + let r1; + beforeEach(() => { + r1 = specification.evaluate(900); + }); + it('should not pass', () => { + expect(r1).toEqual(false); + }); + describe('and the second value evaluated is 1100', () => { + let r2; + beforeEach(() => { + r2 = specification.evaluate(1100); + }); + it('should pass', () => { + expect(r2).toEqual(true); + }); + describe('and the third value evaluated is 999', () => { + let r3; + beforeEach(() => { + r3 = specification.evaluate(999); + }); + it('should pass', () => { + expect(r3).toEqual(true); + }); + }); + describe('and the third value evaluated is 1001', () => { + let r3; + beforeEach(() => { + r3 = specification.evaluate(1001); + }); + it('should not pass', () => { + expect(r3).toEqual(false); + }); + }); + }); + describe('and the second value evaluated is 950', () => { + let r2; + beforeEach(() => { + r2 = specification.evaluate(950); + }); + it('should not pass', () => { + expect(r2).toEqual(false); + }); + }); + }); + describe('and the first value evaluated is 1200', () => { + let r1; + beforeEach(() => { + r1 = specification.evaluate(1200); + }); + it('should not pass', () => { + expect(r1).toEqual(false); + }); + describe('and the second value evaluated is 1100', () => { + let r2; + beforeEach(() => { + r2 = specification.evaluate(1100); + }); + it('should not pass', () => { + expect(r2).toEqual(false); + }); + }); + describe('and the second value evaluated is 950', () => { + let r2; + beforeEach(() => { + r2 = specification.evaluate(950); + }); + it('should pass', () => { + expect(r2).toEqual(true); + }); + }); + }); +}); +describe('When a Crosses specification is initialized with a threshold of zero', () => { + 'use strict'; + + let specification; + beforeEach(() => { + specification = new Crosses(0); + }); + describe('and the first value evaluated is 1', () => { + let r1; + beforeEach(() => { + r1 = specification.evaluate(1); + }); + it('should not pass', () => { + expect(r1).toEqual(false); + }); + describe('and the second value evaluated is -1', () => { + let r2; + beforeEach(() => { + r2 = specification.evaluate(-1); + }); + it('should pass', () => { + expect(r2).toEqual(true); + }); + }); + describe('and the second value evaluated is 0.5', () => { + let r2; + beforeEach(() => { + r2 = specification.evaluate(0.5); + }); + it('should not pass', () => { + expect(r2).toEqual(false); + }); + }); + }); + describe('and the first value evaluated is -1', () => { + let r1; + beforeEach(() => { + r1 = specification.evaluate(-1); + }); + it('should not pass', () => { + expect(r1).toEqual(false); + }); + describe('and the second value evaluated is -0.5', () => { + let r2; + beforeEach(() => { + r2 = specification.evaluate(-0.5); + }); + it('should not pass', () => { + expect(r2).toEqual(false); + }); + }); + describe('and the second value evaluated is 1', () => { + let r2; + beforeEach(() => { + r2 = specification.evaluate(1); + }); + it('should pass', () => { + expect(r2).toEqual(true); + }); + }); + }); +}); + +},{"./../../../specifications/Crosses":67}],137:[function(require,module,exports){ const Equals = require('./../../../specifications/Equals'); describe('When a Equals specification is constructed', () => { @@ -26564,7 +26825,7 @@ describe('When a Equals specification is constructed', () => { }); }); -},{"./../../../specifications/Equals":67}],134:[function(require,module,exports){ +},{"./../../../specifications/Equals":68}],138:[function(require,module,exports){ const Fail = require('./../../../specifications/Fail'); describe('When a Fail specification is constructed', () => { @@ -26604,7 +26865,7 @@ describe('When a Fail specification is constructed', () => { }); }); -},{"./../../../specifications/Fail":68}],135:[function(require,module,exports){ +},{"./../../../specifications/Fail":69}],139:[function(require,module,exports){ const Nan = require('./../../../specifications/Nan'); describe('When a NaN specification is constructed', () => { @@ -26661,7 +26922,7 @@ describe('When a NaN specification is constructed', () => { }); }); -},{"./../../../specifications/Nan":69}],136:[function(require,module,exports){ +},{"./../../../specifications/Nan":70}],140:[function(require,module,exports){ const Not = require('./../../../specifications/Not'), Specification = require('./../../../specifications/Specification'); @@ -26784,7 +27045,34 @@ describe('When a Specification (that always succeeds) is constructed', () => { }); }); -},{"./../../../specifications/Not":70,"./../../../specifications/Specification":74}],137:[function(require,module,exports){ +},{"./../../../specifications/Not":71,"./../../../specifications/Specification":76}],141:[function(require,module,exports){ +const Null = require('./../../../specifications/Null'); + +describe('When a Null specification is constructed', () => { + 'use strict'; + + let specification; + beforeEach(() => { + specification = new Null(); + }); + it('should pass a null value', () => { + expect(specification.evaluate(null)).toEqual(true); + }); + it('should not pass an implicit undefined value', () => { + expect(specification.evaluate()).toEqual(false); + }); + it('should not pass an explicit undefined value', () => { + expect(specification.evaluate(undefined)).toEqual(false); + }); + it('should not pass a zero value', () => { + expect(specification.evaluate(0)).toEqual(false); + }); + it('should not pass an empty-length string value', () => { + expect(specification.evaluate('')).toEqual(false); + }); +}); + +},{"./../../../specifications/Null":72}],142:[function(require,module,exports){ const Numeric = require('./../../../specifications/Numeric'); describe('When a Numeric specification is constructed', () => { @@ -26832,7 +27120,7 @@ describe('When a Numeric specification is constructed', () => { }); }); -},{"./../../../specifications/Numeric":71}],138:[function(require,module,exports){ +},{"./../../../specifications/Numeric":73}],143:[function(require,module,exports){ const Specification = require('./../../../specifications/Specification'), Or = require('./../../../specifications/Or'); @@ -26905,7 +27193,7 @@ describe('When an Or specification is constructed', () => { }); }); -},{"./../../../specifications/Or":72,"./../../../specifications/Specification":74}],139:[function(require,module,exports){ +},{"./../../../specifications/Or":74,"./../../../specifications/Specification":76}],144:[function(require,module,exports){ const Pass = require('./../../../specifications/Pass'); describe('When a Pass specification is constructed', () => { @@ -26945,7 +27233,34 @@ describe('When a Pass specification is constructed', () => { }); }); -},{"./../../../specifications/Pass":73}],140:[function(require,module,exports){ +},{"./../../../specifications/Pass":75}],145:[function(require,module,exports){ +const Undefined = require('./../../../specifications/Undefined'); + +describe('When a Undefined specification is constructed', () => { + 'use strict'; + + let specification; + beforeEach(() => { + specification = new Undefined(); + }); + it('should not pass a null value', () => { + expect(specification.evaluate(null)).toEqual(false); + }); + it('should pass an implicit undefined value', () => { + expect(specification.evaluate()).toEqual(true); + }); + it('should pass an explicit undefined value', () => { + expect(specification.evaluate(undefined)).toEqual(true); + }); + it('should not pass a zero value', () => { + expect(specification.evaluate(0)).toEqual(false); + }); + it('should not pass an empty-length string value', () => { + expect(specification.evaluate('')).toEqual(false); + }); +}); + +},{"./../../../specifications/Undefined":77}],146:[function(require,module,exports){ const Day = require('./../../../../lang/Day'); const After = require('./../../../../specifications/compound/After'); @@ -26968,7 +27283,7 @@ describe('When evaluating a compound After specification', () => { }); }); -},{"./../../../../lang/Day":21,"./../../../../specifications/compound/After":75}],141:[function(require,module,exports){ +},{"./../../../../lang/Day":21,"./../../../../specifications/compound/After":78}],147:[function(require,module,exports){ const Day = require('./../../../../lang/Day'); const Before = require('./../../../../specifications/compound/Before'); @@ -26991,7 +27306,7 @@ describe('When evaluating a compound Before specification', () => { }); }); -},{"./../../../../lang/Day":21,"./../../../../specifications/compound/Before":76}],142:[function(require,module,exports){ +},{"./../../../../lang/Day":21,"./../../../../specifications/compound/Before":79}],148:[function(require,module,exports){ const Day = require('./../../../../lang/Day'); const DaySpecification = require('./../../../../specifications/compound/Day'); @@ -27020,7 +27335,7 @@ describe('When evaluating a compound Day specification', () => { }); }); -},{"./../../../../lang/Day":21,"./../../../../specifications/compound/Day":77}],143:[function(require,module,exports){ +},{"./../../../../lang/Day":21,"./../../../../specifications/compound/Day":80}],149:[function(require,module,exports){ const GreaterThan = require('./../../../../specifications/compound/GreaterThan'); describe('When evaluating a compound GreaterThan specification', () => { @@ -27041,7 +27356,7 @@ describe('When evaluating a compound GreaterThan specification', () => { }); }); -},{"./../../../../specifications/compound/GreaterThan":78}],144:[function(require,module,exports){ +},{"./../../../../specifications/compound/GreaterThan":81}],150:[function(require,module,exports){ const LessThan = require('./../../../../specifications/compound/LessThan'); describe('When evaluating a compound LessThan specification', () => { @@ -27062,7 +27377,7 @@ describe('When evaluating a compound LessThan specification', () => { }); }); -},{"./../../../../specifications/compound/LessThan":79}],145:[function(require,module,exports){ +},{"./../../../../specifications/compound/LessThan":82}],151:[function(require,module,exports){ const Numeric = require('./../../../../specifications/compound/Numeric'); describe('When evaluating a compound Numeric specification', () => { @@ -27089,7 +27404,7 @@ describe('When evaluating a compound Numeric specification', () => { }); }); -},{"./../../../../specifications/compound/Numeric":80}],146:[function(require,module,exports){ +},{"./../../../../specifications/compound/Numeric":83}],152:[function(require,module,exports){ const Day = require('./../../../../lang/Day'); const SameDay = require('./../../../../specifications/compound/SameDay'); @@ -27112,7 +27427,7 @@ describe('When evaluating a compound SameDay specification', () => { }); }); -},{"./../../../../lang/Day":21,"./../../../../specifications/compound/SameDay":81}],147:[function(require,module,exports){ +},{"./../../../../lang/Day":21,"./../../../../specifications/compound/SameDay":84}],153:[function(require,module,exports){ const RateLimiter = require('./../../../timing/RateLimiter'); describe('When a RateLimiter is constructed (1 execution per 25 milliseconds)', () => { @@ -27330,7 +27645,7 @@ describe('When a RateLimiter is constructed (2 execution per 25 milliseconds)', }); }); -},{"./../../../timing/RateLimiter":151}],148:[function(require,module,exports){ +},{"./../../../timing/RateLimiter":157}],154:[function(require,module,exports){ const Scheduler = require('./../../../timing/Scheduler'); describe('When a Scheduler is constructed', () => { @@ -27530,7 +27845,7 @@ describe('When a backoff is used', () => { }); }); -},{"./../../../timing/Scheduler":152}],149:[function(require,module,exports){ +},{"./../../../timing/Scheduler":158}],155:[function(require,module,exports){ const Serializer = require('./../../../timing/Serializer'); describe('When a Serializer is used to schedule four tasks', () => { @@ -27639,7 +27954,7 @@ function getSpy(results, fail) { }); } -},{"./../../../timing/Serializer":153}],150:[function(require,module,exports){ +},{"./../../../timing/Serializer":159}],156:[function(require,module,exports){ const WindowCounter = require('./../../../timing/WindowCounter'); describe('When a WindowCounter is constructed', () => { @@ -27689,7 +28004,7 @@ describe('When a WindowCounter is constructed', () => { }); }); -},{"./../../../timing/WindowCounter":154}],151:[function(require,module,exports){ +},{"./../../../timing/WindowCounter":160}],157:[function(require,module,exports){ const assert = require('./../lang/assert'), Disposable = require('./../lang/Disposable'), promise = require('./../lang/promise'); @@ -27801,7 +28116,7 @@ module.exports = (() => { return RateLimiter; })(); -},{"./../collections/Queue":5,"./../lang/Disposable":23,"./../lang/assert":30,"./../lang/promise":42,"./Scheduler":152}],152:[function(require,module,exports){ +},{"./../collections/Queue":5,"./../lang/Disposable":23,"./../lang/assert":30,"./../lang/promise":42,"./Scheduler":158}],158:[function(require,module,exports){ const assert = require('./../lang/assert'), Disposable = require('./../lang/Disposable'), is = require('./../lang/is'), @@ -28029,7 +28344,7 @@ module.exports = (() => { return Scheduler; })(); -},{"./../lang/Disposable":23,"./../lang/assert":30,"./../lang/is":36,"./../lang/object":41,"./../lang/promise":42}],153:[function(require,module,exports){ +},{"./../lang/Disposable":23,"./../lang/assert":30,"./../lang/is":36,"./../lang/object":41,"./../lang/promise":42}],159:[function(require,module,exports){ const assert = require('./../lang/assert'), Disposable = require('./../lang/Disposable'), promise = require('./../lang/promise'); @@ -28171,7 +28486,7 @@ module.exports = (() => { return Serializer; })(); -},{"./../collections/Queue":5,"./../lang/Disposable":23,"./../lang/assert":30,"./../lang/promise":42}],154:[function(require,module,exports){ +},{"./../collections/Queue":5,"./../lang/Disposable":23,"./../lang/assert":30,"./../lang/promise":42}],160:[function(require,module,exports){ const assert = require('./../lang/assert'); module.exports = (() => { @@ -28286,4 +28601,4 @@ module.exports = (() => { return WindowCounter; })(); -},{"./../lang/assert":30}]},{},[82,83,84,85,88,89,90,91,92,93,94,95,86,87,96,97,98,99,107,108,109,110,100,101,102,103,111,112,113,114,115,116,117,118,119,120,104,121,105,106,122,123,124,125,127,126,128,129,130,140,141,142,143,144,145,146,131,132,133,134,135,136,137,138,139,147,148,149,150]); +},{"./../lang/assert":30}]},{},[85,86,87,88,91,92,93,94,95,96,97,98,89,90,99,100,101,102,110,111,112,113,103,104,105,106,114,115,116,117,118,119,120,121,122,123,107,124,108,109,125,126,127,128,130,129,131,132,133,146,147,148,149,150,151,152,134,135,136,137,138,139,140,141,142,143,144,145,153,154,155,156]);