diff options
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/lodash/internal/equalByTag.js')
-rw-r--r-- | vnfmarket/src/main/webapp/vnfmarket/node_modules/lodash/internal/equalByTag.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/lodash/internal/equalByTag.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/lodash/internal/equalByTag.js new file mode 100644 index 00000000..d25c8e1e --- /dev/null +++ b/vnfmarket/src/main/webapp/vnfmarket/node_modules/lodash/internal/equalByTag.js @@ -0,0 +1,48 @@ +/** `Object#toString` result references. */ +var boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + numberTag = '[object Number]', + regexpTag = '[object RegExp]', + stringTag = '[object String]'; + +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag) { + switch (tag) { + case boolTag: + case dateTag: + // Coerce dates and booleans to numbers, dates to milliseconds and booleans + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + return +object == +other; + + case errorTag: + return object.name == other.name && object.message == other.message; + + case numberTag: + // Treat `NaN` vs. `NaN` as equal. + return (object != +object) + ? other != +other + : object == +other; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings primitives and string + // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + return object == (other + ''); + } + return false; +} + +module.exports = equalByTag; |