{"version":3,"file":"nevis.min.js","sources":["../src/extend.js","../src/equals/comparators/comparator.js","../src/equals/context.js","../src/equals/index.js","../src/equals/builder.js","../src/hash-code/generators/generator.js","../src/hash-code/context.js","../src/hash-code/index.js","../src/hash-code/builder.js","../src/nevis.js","../src/to-string/index.js","../src/util/arrays.js","../src/equals/comparators/collection-comparator.js","../src/equals/comparators/array-comparator.js","../src/equals/comparators/date-comparator.js","../src/equals/comparators/hash-comparator.js","../src/equals/comparators/map-comparator.js","../src/equals/comparators/number-comparator.js","../src/equals/comparators/object-comparator.js","../src/equals/comparators/set-comparator.js","../src/equals/comparators/string-comparator.js","../src/equals/comparators/to-string-comparator.js","../src/equals/comparators/index.js","../src/hash-code/generators/collection-generator.js","../src/hash-code/generators/array-generator.js","../src/hash-code/generators/boolean-generator.js","../src/hash-code/generators/caching-generator.js","../src/hash-code/generators/date-generator.js","../src/hash-code/generators/hash-generator.js","../src/hash-code/generators/map-generator.js","../src/hash-code/generators/object-generator.js","../src/hash-code/generators/set-generator.js","../src/hash-code/generators/string-generator.js","../src/hash-code/generators/to-string-generator.js","../src/hash-code/generators/index.js","../src/index.js","../index.js"],"sourcesContent":["/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\n/**\n * A bare-bones constructor for surrogate prototype swapping.\n *\n * @private\n * @constructor\n */\nvar Constructor = /* istanbul ignore next */ function() {};\n/**\n * A reference to Object.prototype.hasOwnProperty
.\n *\n * @private\n * @type {Function}\n */\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * A reference to Array.prototype.slice
.\n *\n * @private\n * @type {Function}\n */\nvar slice = Array.prototype.slice;\n\n/**\n * Creates an object which inherits the given prototype
.\n *\n * Optionally, the created object can be extended further with the specified properties
.\n *\n * @param {Object} prototype - the prototype to be inherited by the created object\n * @param {Object} [properties] - the optional properties to be extended by the created object\n * @return {Object} The newly created object.\n * @private\n */\nfunction createObject(prototype, properties) {\n var result;\n /* istanbul ignore next */\n if (typeof Object.create === 'function') {\n result = Object.create(prototype);\n } else {\n Constructor.prototype = prototype;\n result = new Constructor();\n Constructor.prototype = null;\n }\n\n if (properties) {\n extendObject(true, result, properties);\n }\n\n return result;\n}\n\n/**\n * Extends the constructor to which this method is associated with the prototype
and/or\n * statics
provided.\n *\n * If name
is provided, it will be used as the class name and can be accessed via a special\n * class_
property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString
), but this is not applicable to the lite version of Nevis.\n *\n * If constructor
is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_
property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor
provided or the one created if none was given.\n * @public\n */\nfunction extend(name, constructor, prototype, statics) {\n var superConstructor = this;\n\n if (typeof name !== 'string') {\n statics = prototype;\n prototype = constructor;\n constructor = name;\n name = null;\n }\n\n if (typeof constructor !== 'function') {\n statics = prototype;\n prototype = constructor;\n constructor = function() {\n return superConstructor.apply(this, arguments);\n };\n }\n\n extendObject(false, constructor, superConstructor, statics);\n\n constructor.prototype = createObject(superConstructor.prototype, prototype);\n constructor.prototype.constructor = constructor;\n\n constructor.class_ = name || superConstructor.class_;\n constructor.super_ = superConstructor;\n\n return constructor;\n}\n\n/**\n * Extends the specified target
object with the properties in each of the sources
provided.\n *\n * if any source is null
it will be ignored.\n *\n * @param {boolean} own - true
to only copy own properties from sources
onto\n * target
; otherwise false
\n * @param {Object} target - the target object which should be extended\n * @param {...Object} [sources] - the source objects whose properties are to be copied onto target
\n * @return {void}\n * @private\n */\nfunction extendObject(own, target, sources) {\n sources = slice.call(arguments, 2);\n\n var property;\n var source;\n\n for (var i = 0, length = sources.length; i < length; i++) {\n source = sources[i];\n\n for (property in source) {\n if (!own || hasOwnProperty.call(source, property)) {\n target[property] = source[property];\n }\n }\n }\n}\n\nmodule.exports = extend;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar extend = require('../../extend');\n\n/**\n * Responsible for comparing the values within a specific {@link EqualsContext} to check whether they are equal.\n *\n * Individual EqualsComparator
implementations should attempt to concentrate on specific value types to\n * keep them small and targeted, allowing other implementations to possibly provide a more suitable comparison. The\n * {@link EqualsContext} should never be modified but can be copied via {@link EqualsContext#copy}.\n *\n * A EqualsComparator
is only called once it has been determined that the values within the\n * {@link EqualsContext} are not exactly equal, neither are null
, and both share the same type.\n *\n * Implementations must implement the {@link EqualsComparator#compare} and {@link EqualsComparator#supports}\n * methods.\n *\n * @protected\n * @constructor\n */\nfunction EqualsComparator() {}\nEqualsComparator.class_ = 'EqualsComparator';\nEqualsComparator.super_ = Object;\n\n/**\n * Extends the constructor to which this method is associated with the prototype
and/or\n * statics
provided.\n *\n * If name
is provided, it will be used as the class name and can be accessed via a special\n * class_
property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString
), but this is not applicable to the lite version of Nevis.\n *\n * If constructor
is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_
property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor
provided or the one created if none was given.\n * @public\n * @static\n * @memberof EqualsComparator\n */\nEqualsComparator.extend = extend;\n\n/**\n * Compares the values within the specified context
.\n *\n * This method is only called when {@link EqualsComparator#supports} indicates that this {@link EqualsComparator}\n * supports context
.\n *\n * @param {EqualsContext} context - the {@link EqualsContext} whose values are to be compared\n * @return {boolean} true
if the values within context
are equal; otherwise\n * false
.\n * @public\n * @abstract\n * @memberof EqualsComparator#\n */\nEqualsComparator.prototype.compare = /* istanbul ignore next */ function compare(context) {};\n\n/**\n * Returns whether this {@link EqualsComparator} supports the specified context
.\n *\n * This method should only return true
when {@link EqualsComparator#compare} can compare the values within\n * context
.\n *\n * @param {EqualsContext} context - the {@link EqualsContext} to be checked\n * @return {boolean} true
if this {@link EqualsComparator} can compare the values within\n * context
; otherwise false
.\n * @public\n * @abstract\n * @memberof EqualsComparator#\n */\nEqualsComparator.prototype.supports = /* istanbul ignore next */ function supports(context) {};\n\nmodule.exports = EqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\n/**\n * Contains the values whose equality is to be tested as well as the string representation and type for the value which\n * can be checked elsewhere for type-checking etc.\n *\n * A EqualsContext
is only created once it has been determined that both values not exactly equal\n * and neither are null
. Once instantiated, {@link EqualsContext#validate} should be called to ensure that\n * both values share the same type.\n *\n * @param {*} value - the value to be checked against other
\n * @param {*} other - the other value to be checked against value
\n * @param {Function} equals - a reference to {@link Nevis.equals} which can be called within an {@link EqualsComparator}\n * @param {?Nevis~EqualsOptions} options - the options to be used (may be null
)\n * @public\n * @constructor\n */\nfunction EqualsContext(value, other, equals, options) {\n if (options == null) {\n options = {};\n }\n\n /**\n * A reference to {@link Nevis.equals} which can be called within an {@link EqualsComparator}.\n *\n * @private\n * @type {Function}\n */\n this._equals = equals;\n\n /**\n * The options to be used to test equality for both of the values.\n *\n * @public\n * @type {Nevis~EqualsOptions}\n */\n this.options = {\n filterProperty: options.filterProperty != null ? options.filterProperty : function() {\n return true;\n },\n ignoreCase: Boolean(options.ignoreCase),\n ignoreEquals: Boolean(options.ignoreEquals),\n ignoreInherited: Boolean(options.ignoreInherited),\n ignoreMethods: Boolean(options.ignoreMethods)\n };\n\n /**\n * The other value to be checked against the value
.\n *\n * @public\n * @type {*}\n */\n this.other = other;\n\n /**\n * The string representation of the values to be tested for equality.\n *\n * This is generated using Object.prototype.toString
and is intended to be primarily used for more\n * specific type-checking.\n *\n * @public\n * @type {string}\n */\n this.string = Object.prototype.toString.call(value);\n\n /**\n * The type of the values to be tested for equality.\n *\n * This is generated using typeof
and is intended to be primarily used for simple type-checking.\n *\n * @public\n * @type {string}\n */\n this.type = typeof value;\n\n /**\n * The value to be checked against the other
.\n *\n * @public\n * @type {*}\n */\n this.value = value;\n}\n\n/**\n * Creates a copy of this {@link EqualsContext} but for the specified value
and other
value\n * instead.\n *\n * This method can be useful for when an {@link EqualsComparator} implementation wants to test equality based on a value\n * derived from the original value (e.g. a string representation) and then passing it to a super class.\n *\n * @param {*} value - the value to be checked against other
\n * @param {*} other - the other value to be checked against value
\n * @return {EqualsContext} A copy of this {@link EqualsContext} for value
and other
.\n * @public\n * @memberof EqualsContext#\n */\nEqualsContext.prototype.copy = function copy(value, other) {\n return new EqualsContext(value, other, this._equals, this.options);\n};\n\n/**\n * A convenient shorthand for calling {@link Nevis.equals} from within an {@link EqualsComparator}.\n *\n * @param {*} value - the value to be checked against other
(may be null
)\n * @param {Function} [value.equals] - the method to be used to test equality for value
and\n * other
, when present\n * @param {*} other - the other value to be checked against value
(may be null
)\n * @return {boolean} true
if value
is equal to other
; otherwise\n * false
.\n * @public\n * @memberof EqualsContext#\n */\nEqualsContext.prototype.equals = function equals(value, other) {\n return this._equals(value, other, this.options);\n};\n\n/**\n * Validates this {@link EqualsContext} by checking whether its values share the same type.\n *\n * This method must be called before attempting to call any {@link EqualsComparator} as they are meant to be able\n * to assume that both values share the same type.\n *\n * @return {boolean} true
if both values share the same type; otherwise false
.\n * @public\n * @memberof EqualsContext#\n */\nEqualsContext.prototype.validate = function validate() {\n return this.string === Object.prototype.toString.call(this.other) && this.type === typeof this.other;\n};\n\nmodule.exports = EqualsContext;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar comparators = require('./comparators');\nvar EqualsContext = require('./context');\n\n/**\n * The list of active equals comparators that will be checked for any that support the values.\n *\n * @private\n * @type {EqualsComparator[]}\n */\nvar activeComparators = [\n new comparators.NumberEqualsComparator(),\n new comparators.StringEqualsComparator(),\n new comparators.DateEqualsComparator(),\n new comparators.ToStringEqualsComparator(),\n new comparators.ArrayEqualsComparator(),\n new comparators.SetEqualsComparator(),\n new comparators.MapEqualsComparator(),\n new comparators.ObjectEqualsComparator()\n];\n\n/**\n * Returns whether the specified value
is \"equal to\" the other
provided using the given\n * options
.\n *\n * Consequently, if both arguments are null
, true
is returned and if exactly one argument is\n * null
, false
is returned. Otherwise, this method implements an equivalence relation on\n * non-null object references:\n *\n *
x
, equals(x, x)
should\n * return true
.x
and y
,\n * equals(x, y)
should return true
if and only if equals(y, x)
returns\n * true
.x
, y
, and z
,\n * if equals(x, y)
returns true
and equals(y, z)
returns true
,\n * then equals(x, z)
should return true
.x
and y
, multiple\n * invocations of equals(x, y)
consistently return true
or consistently return\n * false
, provided no information used in equals
comparisons on the objects is\n * modified.x
, equals(x, null)
should return\n * false
.null
and both are not exactly (strictly) equal, this method will first check whether\n * value
has a method named \"equals\" and, if so, return the result of calling that method with\n * other
passed to it. If no \"equals\" method exists on value
or if the\n * ignoreEquals
option is enabled, it will attempt to test the equality internally based on their type.\n *\n * Plain objects are tested recursively for their properties and collections (e.g. arrays) are also tested recursively\n * for their elements.\n *\n * @param {*} value - the value to be checked against other
(may be null
)\n * @param {Function} [value.equals] - the method to be used to test equality for value
and\n * other
, when present\n * @param {*} other - the other value to be checked against value
(may be null
)\n * @param {Nevis~EqualsOptions} [options] - the options to be used (may be null
)\n * @return {boolean} true
if value
is equal to other
; otherwise\n * false
.\n * @public\n */\nfunction equals(value, other, options) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null) {\n return value === other;\n }\n\n var context = new EqualsContext(value, other, equals, options);\n\n if (!context.options.ignoreEquals && typeof value.equals === 'function') {\n return value.equals(other);\n }\n\n if (!context.validate()) {\n return false;\n }\n\n var comparator;\n var length = activeComparators.length;\n\n for (var i = 0; i < length; i++) {\n comparator = activeComparators[i];\n\n if (comparator.supports(context)) {\n return comparator.compare(context);\n }\n }\n\n return false;\n}\n\nmodule.exports = equals;\n\n/**\n * Called with the name and value of a property belonging to an object whose equality is being tested to determine\n * whether the property should be checked against that on the other object within the equality test.\n *\n * Keep in mind that including a property on one object but not on the other will almost certainly result in\n * inequality.\n *\n * @callback Nevis~EqualsFilterPropertyCallback\n * @param {string} name - the name of the property being checked\n * @param {*} value - the value of the property being checked\n * @param {Object} obj - the object to which the property belongs and that is being checked against another\n * @return {boolean} true
if the equality of the property should be tested against that on the other\n * object; otherwise false
.\n */\n\n/**\n * The options to be used to test equality.\n *\n * @typedef {Object} Nevis~EqualsOptions\n * @property {Nevis~EqualsFilterPropertyCallback} [filterProperty] - A function to be called to filter properties based\n * on their name and value when testing equality of objects to determine whether they should be tested. This is not\n * called for method properties when ignoreMethods
is enabled.\n * @property {boolean} [ignoreCase] - true
to ignore case when testing equality for strings; otherwise\n * false
.\n * @property {boolean} [ignoreEquals] - true
to ignore the \"equals\" method on value, when present;\n * otherwise false
.\n * @property {boolean} [ignoreInherited] - true
to ignore inherited properties when testing equality for\n * objects; otherwise false
.\n * @property {boolean} [ignoreMethods] - true
to ignore method properties when testing equality for\n * objects; otherwise false
.\n */\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar staticEquals = require('./');\n\n/**\n * Assists in building good equals for complex classes.\n *\n * @public\n * @constructor\n */\nfunction EqualsBuilder() {\n /**\n * The current equals for this {@link EqualsBuilder}.\n *\n * @private\n * @type {boolean}\n */\n this._equals = true;\n}\n\n/**\n * Appends the specified value
and other
to this {@link EqualsBuilder}, testing equality for\n * them using the options
provided.\n *\n * @param {*} value - the value to be checked against other
(may be null
)\n * @param {Function} [value.equals] - the method to be used to check equality for value
and\n * other
, when present\n * @param {*} other - the other value to be checked against value
(may be null
)\n * @param {Nevis~EqualsOptions} [options] - the options to be used (may be null
)\n * @return {EqualsBuilder} A reference to this {@link EqualsBuilder} for chaining purposes.\n * @public\n * @memberof EqualsBuilder#\n */\nEqualsBuilder.prototype.append = function append(value, other, options) {\n if (this._equals) {\n this._equals = staticEquals(value, other, options);\n }\n\n return this;\n};\n\n/**\n * Appends the result of testing equality for a super class to this {@link EqualsBuilder}.\n *\n * @param {boolean} superEquals - the result of testing equality for a super class\n * @return {EqualsBuilder} A reference to this {@link EqualsBuilder} for chaining purposes.\n * @public\n * @memberof EqualsBuilder#\n */\nEqualsBuilder.prototype.appendSuper = function appendSuper(superEquals) {\n if (this._equals) {\n this._equals = superEquals;\n }\n\n return this;\n};\n\n/**\n * Returns whether the values that have been appended to this {@link EqualsBuilder} are all equal.\n *\n * @return {boolean} true
if all appended values are equal; otherwise false
.\n * @public\n * @memberof EqualsBuilder#\n */\nEqualsBuilder.prototype.build = function build() {\n return this._equals;\n};\n\nmodule.exports = EqualsBuilder;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar extend = require('../../extend');\n\n/**\n * Responsible for generating a hash code for a specific {@link HashCodeContext}.\n *\n * Individual HashCodeGenerator
implementations should attempt to concentrate on specific value types to\n * keep them small and targeted, allowing other implementations to possibly generate a more suitable hash code. The\n * {@link HashCodeContext} should never be modified but can be copied via {@link HashCodeContext#copy}.\n *\n * Implementations must implement the {@link HashCodeGenerator#generate} and {@link HashCodeGenerator#supports}\n * methods.\n *\n * @protected\n * @constructor\n */\nfunction HashCodeGenerator() {}\nHashCodeGenerator.class_ = 'HashCodeGenerator';\nHashCodeGenerator.super_ = Object;\n\n/**\n * Extends the constructor to which this method is associated with the prototype
and/or\n * statics
provided.\n *\n * If name
is provided, it will be used as the class name and can be accessed via a special\n * class_
property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString
), but this is not applicable to the lite version of Nevis.\n *\n * If constructor
is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_
property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor
provided or the one created if none was given.\n * @public\n * @static\n * @memberof HashCodeGenerator\n */\nHashCodeGenerator.extend = extend;\n\n/**\n * Returns a hash code for the specified context
.\n *\n * This method is only called when {@link HashCodeGenerator#supports} indicates that this {@link HashCodeGenerator}\n * supports context
.\n *\n * @param {HashCodeContext} context - the {@link HashCodeContext} for which the hash code is to be generated\n * @return {number} The hash code generated for context
.\n * @public\n * @abstract\n * @memberof HashCodeGenerator#\n */\nHashCodeGenerator.prototype.generate = /* istanbul ignore next */ function generate(context) {};\n\n/**\n * Returns whether this {@link HashCodeGenerator} supports the specified context
.\n *\n * This method should only return true
when {@link HashCodeGenerator#generate} can generate a hash code for\n * context
.\n *\n * @param {HashCodeContext} context - the {@link HashCodeContext} to be checked\n * @return {boolean} true
if this {@link HashCodeGenerator} can generate a hash code for\n * context
; otherwise false
.\n * @public\n * @abstract\n * @memberof HashCodeGenerator#\n */\nHashCodeGenerator.prototype.supports = /* istanbul ignore next */ function supports(context) {};\n\nmodule.exports = HashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\n/**\n * Contains the value for which a hash code is to be generated as well string representation and type of the value which\n * can be checked elsewhere for type-checking etc.\n *\n * @param {*} value - the value whose hash code is to be generated\n * @param {Function} hashCode - a reference to {@link Nevis.hashCode} which can be called within a\n * {@link HashCodeGenerator}\n * @param {?Nevis~HashCodeOptions} options - the options to be used (may be null
)\n * @protected\n * @constructor\n */\nfunction HashCodeContext(value, hashCode, options) {\n if (options == null) {\n options = {};\n }\n\n /**\n * A reference to {@link Nevis.hashCode} which can be called within a {@link HashCodeGenerator}.\n *\n * @private\n * @type {Function}\n */\n this._hashCode = hashCode;\n\n /**\n * The options to be used to generate the hash code for the value.\n *\n * @public\n * @type {Nevis~HashCodeOptions}\n */\n this.options = {\n allowCache: options.allowCache !== false,\n filterProperty: options.filterProperty != null ? options.filterProperty : function() {\n return true;\n },\n ignoreHashCode: Boolean(options.ignoreHashCode),\n ignoreInherited: Boolean(options.ignoreInherited),\n ignoreMethods: Boolean(options.ignoreMethods)\n };\n\n /**\n * The string representation of the value whose hash code is to be generated.\n *\n * This is generated using Object.prototype.toString
and is intended to be primarily used for more\n * specific type-checking.\n *\n * @public\n * @type {string}\n */\n this.string = Object.prototype.toString.call(value);\n\n /**\n * The type of the value whose hash code is to be generated.\n *\n * This is generated using typeof
and is intended to be primarily used for simple type-checking.\n *\n * @public\n * @type {string}\n */\n this.type = typeof value;\n\n /**\n * The value whose hash code is to be generated.\n *\n * @public\n * @type {*}\n */\n this.value = value;\n}\n\n/**\n * Creates a copy of this {@link HashCodeContext} but for the specified value
instead.\n *\n * This method can be useful for when a {@link HashCodeGenerator} implementation wants to generate the hash code based\n * on a value derived from the original value (e.g. a string representation) and then passing it to a super class.\n *\n * @param {*} value - the value whose hash code is to be generated\n * @return {HashCodeContext} A copy of this {@link HashCodeContext} for value
.\n * @public\n * @memberof HashCodeContext#\n */\nHashCodeContext.prototype.copy = function copy(value) {\n return new HashCodeContext(value, this._hashCode, this.options);\n};\n\n/**\n * A convenient shorthand for calling {@link Nevis.hashCode} from within a {@link HashCodeGenerator}.\n *\n * @param {*} value - the value whose hash code is to be returned (may be null
)\n * @param {Function} [value.hashCode] - the method used to produce the hash code for value
, when present\n * @return {number} A hash code for value
.\n * @public\n * @memberof HashCodeContext#\n */\nHashCodeContext.prototype.hashCode = function hashCode(value) {\n return this._hashCode(value, this.options);\n};\n\nmodule.exports = HashCodeContext;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar generators = require('./generators');\nvar HashCodeContext = require('./context');\n\n/**\n * The list of active generators that will be checked for any that support the value before falling back to\n * {@link defaultGenerator}.\n *\n * @private\n * @type {HashCodeGenerator[]}\n */\nvar activeGenerators = [\n new generators.BooleanHashCodeGenerator(),\n new generators.StringHashCodeGenerator(),\n new generators.DateHashCodeGenerator(),\n new generators.ToStringHashCodeGenerator(),\n new generators.ArrayHashCodeGenerator(),\n new generators.SetHashCodeGenerator(),\n new generators.MapHashCodeGenerator()\n];\n\n/**\n * The default generator to be used when no others support the value.\n *\n * @private\n * @type {HashCodeGenerator}\n */\nvar defaultGenerator = new generators.ObjectHashCodeGenerator();\n\n/**\n * Returns a hash code for the specified value
using the options
provided. This method is\n * supported for the benefit of hash tables.\n *\n * The general contract of hashCode
is:\n *\n * hashCode
method must consistently return the same number, provided no information used to generate the\n * hash code on the value is modified. This number need not remain consistent from one execution of an application to\n * another execution of the same application.hashCode
method on each of the two values must produce\n * the same number result.hashCode
method on each\n * of the two values must produce distinct number results. However, the programmer should be aware that producing\n * distinct number results for unequal values may improve the performance of hash tables.value
is null
, this method will always return zero. Otherwise, it will check whether\n * value
has a method named \"hashCode\" and, if so, return the result of calling that method. If no\n * \"hashCode\" method exists on value
or if the ignoreHashCode
option is enabled, it will\n * attempt to generate the hash code internally based on its type.\n *\n * Plain objects are hashed recursively for their properties and collections (e.g. arrays) are also hashed recursively\n * for their elements.\n *\n * @param {*} value - the value whose hash code is to be returned (may be null
)\n * @param {Function} [value.hashCode] - the method used to produce the hash code for value
, when present\n * @param {Nevis~HashCodeOptions} [options] - the options to be used (may be null
)\n * @return {number} A hash code for value
.\n * @public\n */\nfunction hashCode(value, options) {\n if (value == null) {\n return 0;\n }\n\n var context = new HashCodeContext(value, hashCode, options);\n\n if (!context.options.ignoreHashCode && typeof value.hashCode === 'function') {\n return value.hashCode();\n }\n\n var generator;\n var length = activeGenerators.length;\n\n for (var i = 0; i < length; i++) {\n generator = activeGenerators[i];\n\n if (generator.supports(context)) {\n return generator.generate(context);\n }\n }\n\n return defaultGenerator.generate(context);\n}\n\n/**\n * Clears all previously generated hash codes that may been cached by any active {@link CachingHashCodeGenerator}\n * implementations.\n *\n * Such implementations only cache hash codes generated while the allowCache
option is enabled and it is\n * unlikely that an application would be required to call this method, however, it is here if needed and also for\n * testing purposes.\n *\n * @return {void}\n * @public\n * @static\n * @memberof hashCode\n */\nhashCode.clearCache = function clearCache() {\n activeGenerators.forEach(function(generator) {\n if (typeof generator.clearCache === 'function') {\n generator.clearCache();\n }\n });\n};\n\nmodule.exports = hashCode;\n\n/**\n * Called with the name and value of a property belonging to an object for which a hash code is being generated to\n * determine whether the hash code for the property should be included in that generated for the object.\n *\n * @callback Nevis~HashCodeFilterPropertyCallback\n * @param {string} name - the name of the property being checked\n * @param {*} value - the value of the property being checked\n * @param {Object} obj - the object to which the property belongs and whose hash code is being generated\n * @return {boolean} true
if the hash code for obj
should consist of that generated for the\n * given property; otherwise false
.\n */\n\n/**\n * The options to be used to generate the hash code.\n *\n * @typedef {Object} Nevis~HashCodeOptions\n * @property {boolean} [allowCache=true] - true
to allow generators to cache generated hash codes for\n * faster re-generation; otherwise false
. Only applies to implementations of\n * {@link CachingHashCodeGenerator}.\n * @property {Nevis~HashCodeFilterPropertyCallback} [filterProperty] - A function to be called to filter properties\n * based on their name and value when generating hash codes for objects to determine whether they should be included.\n * This is not called for method properties when ignoreMethods
is enabled.\n * @property {boolean} [ignoreHashCode] - true
to ignore the \"hashCode\" method on value, when present;\n * otherwise false
.\n * @property {boolean} [ignoreInherited] - true
to ignore inherited properties when generating hash codes\n * for objects; otherwise false
.\n * @property {boolean} [ignoreMethods] - true
to ignore method properties when generating hash codes for\n * objects; otherwise false
.\n */\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar staticHashCode = require('./');\n\n/**\n * Assists in building hash codes for complex classes.\n *\n * Ideally the initial
value and multiplier
should be different for each class, however, this\n * is not vital. Prime numbers are preferred, especially for multiplier
.\n *\n * @param {number} [initial=HashCodeBuilder.DEFAULT_INITIAL_VALUE] - the initial value to be used (may be\n * null
but cannot be even)\n * @param {number} [multiplier=HashCodeBuilder.DEFAULT_MULTIPLIER_VALUE] - the multiplier to be used (may be\n * null
but cannot be even)\n * @throws {Error} If either initial
or multiplier
are even numbers.\n * @public\n * @constructor\n */\nfunction HashCodeBuilder(initial, multiplier) {\n if (initial == null) {\n initial = HashCodeBuilder.DEFAULT_INITIAL_VALUE;\n } else if (initial % 2 === 0) {\n throw new Error('initial must be an odd number');\n }\n\n if (multiplier == null) {\n multiplier = HashCodeBuilder.DEFAULT_MULTIPLIER_VALUE;\n } else if (multiplier % 2 === 0) {\n throw new Error('multiplier must be an odd number');\n }\n\n /**\n * The current hash code for this {@link HashCodeBuilder}.\n *\n * @private\n * @type {number}\n */\n this._hash = initial;\n\n /**\n * The multiplier to be used by this {@link HashCodeBuilder}.\n *\n * @private\n * @type {number}\n */\n this._multiplier = multiplier;\n}\n\n/**\n * The default initial value to use in hash code building.\n *\n * @public\n * @static\n * @type {number}\n * @memberof HashCodeBuilder\n */\nHashCodeBuilder.DEFAULT_INITIAL_VALUE = 17;\n\n/**\n * The default multiplier value to use in hash code building.\n *\n * @public\n * @static\n * @type {number}\n * @memberof HashCodeBuilder\n */\nHashCodeBuilder.DEFAULT_MULTIPLIER_VALUE = 37;\n\n/**\n * Appends the specified value
to this {@link HashCodeBuilder}, generating the hash code for it using the\n * options
provided.\n *\n * @param {*} value - the value whose hash code is to be appended (may be null
)\n * @param {Function} [value.hashCode] - the method used to produce the hash code for value
, when present\n * @param {Nevis~HashCodeOptions} [options] - the options to be used (may be null
)\n * @return {HashCodeBuilder} A reference to this {@link HashCodeBuilder} for chaining purposes.\n * @public\n * @memberof HashCodeBuilder#\n */\nHashCodeBuilder.prototype.append = function append(value, options) {\n this._hash = (this._hash * this._multiplier) + staticHashCode(value, options);\n\n return this;\n};\n\n/**\n * Appends the result of computing the hash code for a super class to this {@link HashCodeBuilder}.\n *\n * @param {number} superHashCode - the result of computing the hash code for a super class\n * @return {HashCodeBuilder} A reference to this {@link HashCodeBuilder} for chaining purposes.\n * @public\n * @memberof HashCodeBuilder#\n */\nHashCodeBuilder.prototype.appendSuper = function appendSuper(superHashCode) {\n this._hash = (this._hash * this._multiplier) + superHashCode;\n\n return this;\n};\n\n/**\n * Returns the computed hash code.\n *\n * @return {number} The hash code based on the appended values.\n * @public\n * @memberof HashCodeBuilder#\n */\nHashCodeBuilder.prototype.build = function build() {\n return this._hash;\n};\n\n/**\n * Returns the hash code for this {@link HashCodeBuilder}.\n *\n * This method will return the computed hash code based on the appended values.\n *\n * @return {number} The hash code.\n * @public\n * @memberof HashCodeBuilder#\n */\nHashCodeBuilder.prototype.hashCode = function hashCode() {\n return this._hash;\n};\n\nmodule.exports = HashCodeBuilder;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar extend = require('./extend');\n\n/**\n * The base class from which all others should extend.\n *\n * @public\n * @constructor\n */\nfunction Nevis() {}\nNevis.class_ = 'Nevis';\nNevis.super_ = Object;\n\n/**\n * Extends the constructor to which this method is associated with the prototype
and/or\n * statics
provided.\n *\n * If name
is provided, it will be used as the class name and can be accessed via a special\n * class_
property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString
), but this is not applicable to the lite version of Nevis.\n *\n * If constructor
is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_
property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor
provided or the one created if none was given.\n * @public\n * @static\n * @memberof Nevis\n */\nNevis.extend = extend;\n\nmodule.exports = Nevis;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\n/**\n * Returns the result of calling the toString
method on the specified value
when it is\n * non-null.\n *\n * If value
is null
or undefined
, this method will return \"null\"
or\n * \"undefined\"
respectively.\n *\n * @param {*} value - the value whose string representation is to be returned (may be null
)\n * @return {string} The string representation of value
.\n * @public\n */\nfunction toString(value) {\n if (typeof value === 'undefined') {\n return 'undefined';\n }\n if (value == null) {\n return 'null';\n }\n\n return value.toString();\n}\n\nmodule.exports = toString;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\n/**\n * The strings for all array types (incl. typed arrays), as generated by Object.prototype.toString
.\n *\n * @public\n * @type {string[]}\n */\nexports.typeStrings = [\n 'Array',\n 'Int8Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'Int16Array',\n 'Uint16Array',\n 'Int32Array',\n 'Uint32Array',\n 'Float32Array',\n 'Float64Array'\n].map(function(str) {\n return '[object ' + str + ']';\n});\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar EqualsComparator = require('./comparator');\n\n/**\n * An abstract implementation of {@link EqualsComparator} that is intended for implementations that wish to support\n * values types that contain a collection of other values. This is achieved by requesting the elements contained within\n * e value as an array from the implementation and then compares each element to determine whether the values are equal.\n *\n * Implementations must implement the {@link CollectionEqualsComparator#getElements} and\n * {@link EqualsComparator#supports} methods.\n *\n * @protected\n * @constructor\n * @extends EqualsComparator\n */\nvar CollectionEqualsComparator = EqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof CollectionEqualsComparator#\n */\n compare: function compare(context) {\n var elements = this.getElements(context.value, context);\n var otherElements = this.getElements(context.other, context);\n var length = elements.length;\n\n if (length !== otherElements.length) {\n return false;\n }\n\n while (length--) {\n if (!context.equals(elements[length], otherElements[length])) {\n return false;\n }\n }\n\n return true;\n },\n\n /**\n * Returns the elements contained within the specified collection
.\n *\n * @param {*} collection - the collection whose elements are to be returned\n * @param {EqualsContext} context - the current {@link EqualsContext}\n * @return {Array} The elements contained within collection
.\n * @protected\n * @abstract\n * @memberof CollectionEqualsComparator#\n */\n getElements: /* istanbul ignore next */ function getElements(collection, context) {}\n\n});\n\nmodule.exports = CollectionEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar arrays = require('../../util/arrays');\nvar CollectionEqualsComparator = require('./collection-comparator');\n\n/**\n * An implementation of {@link CollectionEqualsComparator} that supports array values.\n *\n * @protected\n * @constructor\n * @extends CollectionEqualsComparator\n */\nvar ArrayEqualsComparator = CollectionEqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof ArrayEqualsComparator#\n */\n getElements: function getElements(collection) {\n return collection;\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof ArrayEqualsComparator#\n */\n supports: function supports(context) {\n return arrays.typeStrings.indexOf(context.string) >= 0;\n }\n\n});\n\nmodule.exports = ArrayEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar EqualsComparator = require('./comparator');\n\n/**\n * An implementation of {@link EqualsComparator} that supports date values.\n *\n * @protected\n * @constructor\n * @extends EqualsComparator\n */\nvar DateEqualsComparator = EqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof DateEqualsComparator#\n */\n compare: function compare(context) {\n return context.value.getTime() === context.other.getTime();\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof DateEqualsComparator#\n */\n supports: function supports(context) {\n return context.string === '[object Date]';\n }\n\n});\n\nmodule.exports = DateEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar EqualsComparator = require('./comparator');\n\n/**\n * An abstract implementation of {@link EqualsComparator} that is intended for implementations that wish to support\n * value types that represent a hash of key/value pairs. This is achieved by requesting the keys contained within each\n * value as an array from the implementation and then compares each key/value pair to determine whether the values are\n * equal.\n *\n * Implementations must implement the {@link HashEqualsComparator#getKeys}, {@link HashEqualsComparator#getValue}\n * and {@link EqualsComparator#supports} methods.\n *\n * @protected\n * @constructor\n * @extends EqualsComparator\n */\nvar HashEqualsComparator = EqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof HashEqualsComparator#\n */\n compare: function compare(context) {\n var value = context.value;\n var other = context.other;\n var keys = this.getKeys(value, context);\n var length = keys.length;\n\n if (length !== this.getKeys(other, context).length) {\n return false;\n }\n\n var key;\n\n while (length--) {\n key = keys[length];\n\n if (!context.equals(this.getValue(value, key, context), this.getValue(other, key, context))) {\n return false;\n }\n }\n\n return true;\n },\n\n /**\n * Returns the keys contained within the value of the specified hash
.\n *\n * @param {*} hash - the hash whose keys are to be returned\n * @param {EqualsContext} context - the current {@link EqualsContext}\n * @return {Array} The keys contained within hash
.\n * @protected\n * @abstract\n * @memberof HashEqualsComparator#\n */\n getKeys: /* istanbul ignore next */ function getKeys(hash, context) {},\n\n /**\n * Returns the value associated with the specified key
in the hash
provided.\n *\n * @param {*} hash - the hash from which the value is to be returned\n * @param {*} key - the key for which the associated value is to be returned\n * @param {EqualsContext} context - the current {@link EqualsContext}\n * @return {*} The value for key
within hash
.\n * @protected\n * @abstract\n * @memberof HashEqualsComparator#\n */\n getValue: /* istanbul ignore next */ function getValue(hash, key, context) {}\n\n});\n\nmodule.exports = HashEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar HashEqualsComparator = require('./hash-comparator');\n\n/**\n * An implementation of {@link HashEqualsComparator} that supports map values.\n *\n * MapEqualsComparator
ignores insertion order when comparing maps.\n *\n * @protected\n * @constructor\n * @extends HashEqualsComparator\n */\nvar MapEqualsComparator = HashEqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof MapEqualsComparator#\n */\n getKeys: function getKeys(hash) {\n return Array.from(hash.keys());\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof MapEqualsComparator#\n */\n getValue: function getValue(hash, key) {\n return hash.get(key);\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof MapEqualsComparator#\n */\n supports: function supports(context) {\n return context.string === '[object Map]';\n }\n\n});\n\nmodule.exports = MapEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar EqualsComparator = require('./comparator');\n\n/**\n * An implementation of {@link EqualsComparator} that supports number values (including NaN
).\n *\n * @protected\n * @constructor\n * @extends EqualsComparator\n */\nvar NumberEqualsComparator = EqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof NumberEqualsComparator#\n */\n compare: function compare(context) {\n return context.value !== context.value ? context.other !== context.other : context.value === context.other;\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof NumberEqualsComparator#\n */\n supports: function supports(context) {\n return context.type === 'number';\n }\n\n});\n\nmodule.exports = NumberEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar HashEqualsComparator = require('./hash-comparator');\n\n/**\n * An implementation of {@link HashEqualsComparator} that supports plain old object values.\n *\n * @protected\n * @constructor\n * @extends HashEqualsComparator\n */\nvar ObjectEqualsComparator = HashEqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof ObjectEqualsComparator#\n */\n getKeys: function getKeys(hash, context) {\n var keys = [];\n var options = context.options;\n var value;\n\n for (var key in hash) {\n if (!options.ignoreInherited || Object.prototype.hasOwnProperty.call(hash, key)) {\n value = this.getValue(hash, key, context);\n\n if ((typeof value !== 'function' || !options.ignoreMethods) && options.filterProperty(key, value, hash)) {\n keys.push(key);\n }\n }\n }\n\n return keys;\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof ObjectEqualsComparator#\n */\n getValue: function getValue(hash, key) {\n return hash[key];\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof ObjectEqualsComparator#\n */\n supports: function supports(context) {\n return context.type === 'object';\n }\n\n});\n\nmodule.exports = ObjectEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar CollectionEqualsComparator = require('./collection-comparator');\n\n/**\n * An implementation of {@link CollectionEqualsComparator} that supports set values.\n *\n * @protected\n * @constructor\n * @extends CollectionEqualsComparator\n */\nvar SetEqualsComparator = CollectionEqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof SetEqualsComparator#\n */\n getElements: function getElements(collection) {\n return Array.from(collection);\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof SetEqualsComparator#\n */\n supports: function supports(context) {\n return context.string === '[object Set]';\n }\n\n});\n\nmodule.exports = SetEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar EqualsComparator = require('./comparator');\n\n/**\n * An implementation of {@link EqualsComparator} that supports string values.\n *\n * @protected\n * @constructor\n * @extends EqualsComparator\n */\nvar StringEqualsComparator = EqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof StringEqualsComparator#\n */\n compare: function compare(context) {\n var other = context.other;\n var value = context.value;\n\n if (context.options.ignoreCase) {\n other = other.toLocaleUpperCase();\n value = value.toLocaleUpperCase();\n }\n\n return value === other;\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof StringEqualsComparator#\n */\n supports: function supports(context) {\n return context.type === 'string';\n }\n\n});\n\nmodule.exports = StringEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar EqualsComparator = require('./comparator');\n\n/**\n * An implementation of {@link EqualsComparator} that supports miscellaneous values by comparing their string\n * representations (generated by calling toString
on each value).\n *\n * This {@link EqualsComparator} currently only supports functions and regular expressions.\n *\n * @protected\n * @constructor\n * @extends EqualsComparator\n */\nvar ToStringEqualsComparator = EqualsComparator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof ToStringEqualsComparator#\n */\n compare: function compare(context) {\n return context.value.toString() === context.other.toString();\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof ToStringEqualsComparator#\n */\n supports: function supports(context) {\n return context.type === 'function' || context.string === '[object RegExp]';\n }\n\n});\n\nmodule.exports = ToStringEqualsComparator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar ArrayEqualsComparator = require('./array-comparator');\nvar CollectionEqualsComparator = require('./collection-comparator');\nvar DateEqualsComparator = require('./date-comparator');\nvar EqualsComparator = require('./comparator');\nvar HashEqualsComparator = require('./hash-comparator');\nvar MapEqualsComparator = require('./map-comparator');\nvar NumberEqualsComparator = require('./number-comparator');\nvar ObjectEqualsComparator = require('./object-comparator');\nvar SetEqualsComparator = require('./set-comparator');\nvar StringEqualsComparator = require('./string-comparator');\nvar ToStringEqualsComparator = require('./to-string-comparator');\n\n/**\n * A hash containing constructors for all equals comparators.\n *\n * @public\n * @type {Object.context
.\n *\n * @param {HashCodeContext} context - the {@link HashCodeContext} containing the value whose children elements are to\n * be returned\n * @return {Array} The elements contained within the value of context
.\n * @protected\n * @abstract\n * @memberof CollectionHashCodeGenerator#\n */\n getElements: /* istanbul ignore next */ function getElements(context) {}\n\n});\n\nmodule.exports = CollectionHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar arrays = require('../../util/arrays');\nvar CollectionHashCodeGenerator = require('./collection-generator');\n\n/**\n * An implementation of {@link CollectionHashCodeGenerator} that supports array values.\n *\n * @protected\n * @constructor\n * @extends CollectionHashCodeGenerator\n */\nvar ArrayHashCodeGenerator = CollectionHashCodeGenerator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof ArrayHashCodeGenerator#\n */\n getElements: function getElements(context) {\n return context.value;\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof ArrayHashCodeGenerator#\n */\n supports: function supports(context) {\n return arrays.typeStrings.indexOf(context.string) >= 0;\n }\n\n});\n\nmodule.exports = ArrayHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar HashCodeGenerator = require('./generator');\n\n/**\n * An implementation of {@link HashCodeGenerator} that supports boolean values.\n *\n * @protected\n * @constructor\n * @extends HashCodeGenerator\n */\nvar BooleanHashCodeGenerator = HashCodeGenerator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof BooleanHashCodeGenerator#\n */\n generate: function generate(context) {\n return context.value ? 1231 : 1237;\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof BooleanHashCodeGenerator#\n */\n supports: function supports(context) {\n return context.type === 'boolean';\n }\n\n});\n\nmodule.exports = BooleanHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar HashCodeGenerator = require('./generator');\n\n/**\n * An abstract implementation of {@link HashCodeGenerator} that is intended for implementations that wish to cache\n * generated hash codes to avoid re-generating them for the same values. Obviously, this should only ever be done for\n * immutable values.\n *\n * Generated hash codes should only ever be cached when the allowCache
option is enabled, however, the\n * cache will always be checked before attempting to generate a hash code for a value.\n *\n * Implementations must implement the {@link CachingHashCodeGenerator#generateInternal} and\n * {@link HashCodeGenerator#supports} methods.\n *\n * @protected\n * @constructor\n * @extends HashCodeGenerator\n */\nvar CachingHashCodeGenerator = HashCodeGenerator.extend(function() {\n /**\n * A cache of values mapped to their previously generated hash codes.\n *\n * @private\n * @type {Object.<*, number>}\n * @memberof CachingHashCodeGenerator#\n */\n this._cache = {};\n}, {\n\n /**\n * Clears the cache of hash codes that have been previously generated by this {@link CachingHashCodeGenerator} while\n * the allowCache
option has been enabled.\n *\n * @return {void}\n * @public\n * @memberof CachingHashCodeGenerator#\n */\n clearCache: function clearCache() {\n this._cache = {};\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof CachingHashCodeGenerator#\n */\n generate: function generate(context) {\n var hash = this._cache[context.value];\n\n if (hash == null) {\n hash = this.generateInternal(context);\n\n if (context.options.allowCache) {\n this._cache[context.value] = hash;\n }\n }\n\n return hash;\n },\n\n /**\n * Returns a hash code for the specified context
.\n *\n * This method is called internally by {@link CachingHashCodeGenerator#generate} only when a hash code needs to be\n * generated (i.e. the cache doesn't contain a previously generated hash code for the value of context
).\n *\n * @param {HashCodeContext} context - the {@link HashCodeContext} for which the hash code is to be generated\n * @return {number} The hash code generated for context
.\n * @protected\n * @abstract\n * @memberof CachingHashCodeGenerator#\n */\n generateInternal: /* istanbul ignore next */ function generateInternal(context) {}\n\n});\n\nmodule.exports = CachingHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar HashCodeGenerator = require('./generator');\n\n/**\n * An implementation of {@link HashCodeGenerator} that supports date values.\n *\n * @protected\n * @constructor\n * @extends HashCodeGenerator\n */\nvar DateHashCodeGenerator = HashCodeGenerator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof DateHashCodeGenerator#\n */\n generate: function generate(context) {\n return context.value.getTime();\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof DateHashCodeGenerator#\n */\n supports: function supports(context) {\n return context.string === '[object Date]';\n }\n\n});\n\nmodule.exports = DateHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar HashCodeGenerator = require('./generator');\n\n/**\n * An abstract implementation of {@link HashCodeGenerator} that is intended for implementations that wish to support\n * value types that represent a hash of key/value pairs. This is achieved by requesting the entries of key/value pairs\n * contained within the value as an multi-dimensional array from the implementation and then generates hash codes for\n * each entry to compute the hash code for the value.\n *\n * Implementations must implement the {@link HashHashCodeGenerator#getEntries} and\n * {@link HashCodeGenerator#supports} methods.\n *\n * @protected\n * @constructor\n * @extends HashCodeGenerator\n */\nvar HashHashCodeGenerator = HashCodeGenerator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof HashHashCodeGenerator#\n */\n generate: function generate(context) {\n var entries = this.getEntries(context);\n\n return entries.reduce(function(hash, entry) {\n return hash + (context.hashCode(entry[0]) ^ context.hashCode(entry[1]));\n }, 0);\n },\n\n /**\n * Returns the entries contained within the value of the specified context
.\n *\n * This method returns a multi-dimensional array where each entry is an array consisting of the key and value, in that\n * order.\n *\n * @param {HashCodeContext} context - the {@link HashCodeContext} containing the value whose entries are to be\n * returned\n * @return {Array.context
.\n * @protected\n * @abstract\n * @memberof HashHashCodeGenerator#\n */\n getEntries: /* istanbul ignore next */ function getEntries(context) {}\n\n});\n\nmodule.exports = HashHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar HashHashCodeGenerator = require('./hash-generator');\n\n/**\n * An implementation of {@link HashHashCodeGenerator} that supports map values.\n *\n * Insertion order should have no impact on the hash code generated by MapHashCodeGenerator
.\n *\n * @protected\n * @constructor\n * @extends HashHashCodeGenerator\n */\nvar MapHashCodeGenerator = HashHashCodeGenerator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof MapHashCodeGenerator#\n */\n getEntries: function getEntries(context) {\n return Array.from(context.value.entries());\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof MapHashCodeGenerator#\n */\n supports: function supports(context) {\n return context.string === '[object Map]';\n }\n\n});\n\nmodule.exports = MapHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar HashHashCodeGenerator = require('./hash-generator');\n\n/**\n * An implementation of {@link HashHashCodeGenerator} that supports plain old object values.\n *\n * @protected\n * @constructor\n * @extends HashHashCodeGenerator\n */\nvar ObjectHashCodeGenerator = HashHashCodeGenerator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof ObjectHashCodeGenerator#\n */\n getEntries: function getEntries(context) {\n var entries = [];\n var hash = context.value;\n var options = context.options;\n var value;\n\n for (var name in hash) {\n if (!options.ignoreInherited || Object.prototype.hasOwnProperty.call(hash, name)) {\n value = hash[name];\n\n if ((typeof value !== 'function' || !options.ignoreMethods) && options.filterProperty(name, value, hash)) {\n entries.push([ name, value ]);\n }\n }\n }\n\n return entries;\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof ObjectHashCodeGenerator#\n */\n supports: function supports(context) {\n return context.type === 'object';\n }\n\n});\n\nmodule.exports = ObjectHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar CollectionHashCodeGenerator = require('./collection-generator');\n\n/**\n * An implementation of {@link CollectionHashCodeGenerator} that supports set values.\n *\n * @protected\n * @constructor\n * @extends CollectionHashCodeGenerator\n */\nvar SetHashCodeGenerator = CollectionHashCodeGenerator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof SetHashCodeGenerator#\n */\n getElements: function getElements(context) {\n return Array.from(context.value);\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof SetHashCodeGenerator#\n */\n supports: function supports(context) {\n return context.string === '[object Set]';\n }\n\n});\n\nmodule.exports = SetHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar CachingHashCodeGenerator = require('./caching-generator');\n\n/**\n * An implementation of {@link CachingHashCodeGenerator} that supports string values.\n *\n * @protected\n * @constructor\n * @extends CachingHashCodeGenerator\n */\nvar StringHashCodeGenerator = CachingHashCodeGenerator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof StringHashCodeGenerator#\n */\n generateInternal: function generateInternal(context) {\n var hash = 0;\n var length = context.value.length;\n\n for (var i = 0; i < length; i++) {\n hash = ((31 * hash) + context.value.charCodeAt(i)) | 0;\n }\n\n return hash;\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof StringHashCodeGenerator#\n */\n supports: function supports(context) {\n return context.type === 'string';\n }\n\n});\n\nmodule.exports = StringHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar StringHashCodeGenerator = require('./string-generator');\n\n/**\n * An extension of {@link StringHashCodeGenerator} that supports miscellaneous values by generating hash codes for their\n * string representations (generated by calling toString
on the value).\n *\n * This {@link HashCodeGenerator} currently only supports functions, numbers and regular expressions.\n *\n * @protected\n * @constructor\n * @extends StringHashCodeGenerator\n */\nvar ToStringHashCodeGenerator = StringHashCodeGenerator.extend({\n\n /**\n * @inheritdoc\n * @override\n * @memberof ToStringHashCodeGenerator#\n */\n generate: function generate(context) {\n return ToStringHashCodeGenerator.super_.prototype.generate.call(this, context.copy(context.value.toString()));\n },\n\n /**\n * @inheritdoc\n * @override\n * @memberof ToStringHashCodeGenerator#\n */\n supports: function supports(context) {\n return context.type === 'function' || context.type === 'number' || context.string === '[object RegExp]';\n }\n\n});\n\nmodule.exports = ToStringHashCodeGenerator;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar ArrayHashCodeGenerator = require('./array-generator');\nvar BooleanHashCodeGenerator = require('./boolean-generator');\nvar CachingHashCodeGenerator = require('./caching-generator');\nvar CollectionHashCodeGenerator = require('./collection-generator');\nvar DateHashCodeGenerator = require('./date-generator');\nvar HashCodeGenerator = require('./generator');\nvar HashHashCodeGenerator = require('./hash-generator');\nvar MapHashCodeGenerator = require('./map-generator');\nvar ObjectHashCodeGenerator = require('./object-generator');\nvar SetHashCodeGenerator = require('./set-generator');\nvar StringHashCodeGenerator = require('./string-generator');\nvar ToStringHashCodeGenerator = require('./to-string-generator');\n\n/**\n * A hash containing constructors for all hash code generators.\n *\n * @public\n * @type {Object.value
is \"equal to\" the other
provided using the given\n * options
.\n *\n * Consequently, if both arguments are null
, true
is returned and if exactly one argument is\n * null
, false
is returned. Otherwise, this method implements an equivalence relation on\n * non-null object references:\n *\n * x
, equals(x, x)
should\n * return true
.x
and y
,\n * equals(x, y)
should return true
if and only if equals(y, x)
returns\n * true
.x
, y
, and z
,\n * if equals(x, y)
returns true
and equals(y, z)
returns true
,\n * then equals(x, z)
should return true
.x
and y
, multiple\n * invocations of equals(x, y)
consistently return true
or consistently return\n * false
, provided no information used in equals
comparisons on the objects is\n * modified.x
, equals(x, null)
should return\n * false
.null
and both are not exactly (strictly) equal, this method will first check whether\n * value
has a method named \"equals\" and, if so, return the result of calling that method with\n * other
passed to it. If no \"equals\" method exists on value
or if the\n * ignoreEquals
option is enabled, it will attempt to test the equality internally based on their type.\n *\n * Plain objects are tested recursively for their properties and collections (e.g. arrays) are also tested recursively\n * for their elements.\n *\n * @param {*} value - the value to be checked against other
(may be null
)\n * @param {Function} [value.equals] - the method to be used to test equality for value
and\n * other
, when present\n * @param {*} other - the other value to be checked against value
(may be null
)\n * @param {Nevis~EqualsOptions} [options] - the options to be used (may be null
)\n * @return {boolean} true
if value
is equal to other
; otherwise\n * false
.\n * @public\n * @static\n * @memberof Nevis\n */\nNevis.equals = staticEquals;\n\n/**\n * Assists in building good equals for complex classes.\n *\n * @public\n * @static\n * @constructor\n * @memberof Nevis\n */\nNevis.EqualsBuilder = EqualsBuilder;\n\n/**\n * Returns a hash code for the specified value
using the options
provided. This method is\n * supported for the benefit of hash tables.\n *\n * The general contract of hashCode
is:\n *\n * hashCode
method must consistently return the same number, provided no information used to generate the\n * hash code on the value is modified. This number need not remain consistent from one execution of an application to\n * another execution of the same application.hashCode
method on each of the two values must produce\n * the same number result.hashCode
method on each\n * of the two values must produce distinct number results. However, the programmer should be aware that producing\n * distinct number results for unequal values may improve the performance of hash tables.value
is null
, this method will always return zero. Otherwise, it will check whether\n * value
has a method named \"hashCode\" and, if so, return the result of calling that method. If no\n * \"hashCode\" method exists on value
or if the ignoreHashCode
option is enabled, it will\n * attempt to generate the hash code internally based on its type.\n *\n * Plain objects are hashed recursively for their properties and collections (e.g. arrays) are also hashed recursively\n * for their elements.\n *\n * @param {*} value - the value whose hash code is to be returned (may be null
)\n * @param {Function} [value.hashCode] - the method used to produce the hash code for value
, when present\n * @param {Nevis~HashCodeOptions} [options] - the options to be used (may be null
)\n * @return {number} A hash code for value
.\n * @public\n * @static\n * @memberof Nevis\n */\nNevis.hashCode = staticHashCode;\n\n/**\n * Assists in building hash codes for complex classes.\n *\n * Ideally the initial
value and multiplier
should be different for each class, however, this\n * is not vital. Prime numbers are preferred, especially for multiplier
.\n *\n * @param {number} [initial=HashCodeBuilder.DEFAULT_INITIAL_VALUE] - the initial value to be used (may be\n * null
but cannot be even)\n * @param {number} [multiplier=HashCodeBuilder.DEFAULT_MULTIPLIER_VALUE] - the multiplier to be used (may be\n * null
but cannot be even)\n * @throws {Error} If either initial
or multiplier
are even numbers.\n * @public\n * @static\n * @constructor\n * @memberof Nevis\n */\nNevis.HashCodeBuilder = HashCodeBuilder;\n\n/**\n * Returns the result of calling the toString
method on the specified value
when it is\n * non-null.\n *\n * If value
is null
or undefined
, this method will return \"null\"
or\n * \"undefined\"
respectively.\n *\n * @param {*} value - the value whose string representation is to be returned (may be null
)\n * @return {string} The string representation of value
.\n * @public\n * @static\n * @memberof Nevis\n */\nNevis.toString = staticToString;\n\n/**\n * Returns whether this instance is \"equal to\" the specified obj
.\n *\n * This method implements an equivalence relation on non-null object references:\n *\n * x
, x.equals(x)
should return\n * true
.x
and y
,\n * x.equals(y)
should return true
if and only if y.equals(x)
returns\n * true
.x
, y
, and z
,\n * if x.equals(y)
returns true
and y.equals(z)
returns true
, then\n * x.equals(z)
should return true
.x
and y
, multiple\n * invocations of x.equals(y)
consistently return true
or consistently return\n * false
, provided no information used in equals
comparisons on the objects is\n * modified.x
, x.equals(null)
should return\n * false
.x
and y
, this method returns true
if,\n * and only if, x
and y
are exactly equal (x === y
has the value\n * true
).\n *\n * Please note that it is generally necessary to override the {@link Nevis#hashCode} method whenever this method is\n * overridden, so as to maintain the general contract for the {@link Nevis#hashCode} method, which states that equal\n * objects must have equal hash codes.\n *\n * @param {*} obj - the reference to which this instance is to be compared (may be null
)\n * @return {boolean} true
if this instance is equal to obj
; otherwise false
.\n * @public\n * @memberof Nevis#\n */\nNevis.prototype.equals = function equals(obj) {\n return this === obj;\n};\n\n/**\n * Returns the hash code for this instance. This method is supported for the benefit of hash tables.\n *\n * The general contract of hashCode
is:\n *\n * hashCode
method must consistently return the same number, provided no information used to generate the\n * hash code on the instance is modified. This number need not remain consistent from one execution of an application\n * to another execution of the same application.hashCode
method on each of the two instances must\n * produce the same number result.hashCode
method on\n * each of the two instances must produce distinct number results. However, the programmer should be aware that\n * producing distinct number results for unequal instances may improve the performance of hash tables.@
), and the hexadecimal representation of the hash code of this instance.\n *\n * @return {string} A string representation of this instance.\n * @public\n * @memberof Nevis#\n */\nNevis.prototype.toString = function toString() {\n return this.constructor.class_ + '@' + this.hashCode().toString(16);\n};\n\nmodule.exports = Nevis;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nmodule.exports = require('./src');\n"],"names":["createObject","prototype","properties","result","Object","create","Constructor","extendObject","extend","name","constructor","statics","superConstructor","this","apply","arguments","class_","super_","own","target","sources","slice","call","property","source","i","length","hasOwnProperty","EqualsComparator","EqualsContext","value","other","equals","options","_equals","filterProperty","ignoreCase","Boolean","ignoreEquals","ignoreInherited","ignoreMethods","string","toString","type","context","validate","comparator","activeComparators","supports","compare","EqualsBuilder","HashCodeGenerator","HashCodeContext","hashCode","_hashCode","allowCache","ignoreHashCode","generator","activeGenerators","generate","defaultGenerator","HashCodeBuilder","initial","multiplier","DEFAULT_INITIAL_VALUE","Error","DEFAULT_MULTIPLIER_VALUE","_hash","_multiplier","Nevis","map","str","Array","CollectionEqualsComparator","elements","getElements","otherElements","collection","ArrayEqualsComparator","arrays","typeStrings","indexOf","DateEqualsComparator","getTime","HashEqualsComparator","keys","getKeys","key","getValue","hash","MapEqualsComparator","from","get","NumberEqualsComparator","ObjectEqualsComparator","push","SetEqualsComparator","StringEqualsComparator","toLocaleUpperCase","ToStringEqualsComparator","copy","comparators","append","staticEquals","appendSuper","superEquals","build","CollectionHashCodeGenerator","reduce","element","ArrayHashCodeGenerator","BooleanHashCodeGenerator","CachingHashCodeGenerator","_cache","clearCache","generateInternal","DateHashCodeGenerator","HashHashCodeGenerator","entries","getEntries","entry","MapHashCodeGenerator","ObjectHashCodeGenerator","SetHashCodeGenerator","StringHashCodeGenerator","charCodeAt","ToStringHashCodeGenerator","generators","forEach","staticHashCode","superHashCode","staticToString","obj","require$$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