Comparing version 2.1.0 to 2.1.1
@@ -47,3 +47,3 @@ /* eslint no-console: 0 */ | ||
console.log('Primitive objects:'); | ||
console.log('Standard value objects:'); | ||
@@ -58,13 +58,13 @@ // primitive tests | ||
logAndSave(test('undefined', hashUndefined)); | ||
logAndSave(test('Function', hashFunction)); | ||
logAndSave(test('RegExp', hashRegExp)); | ||
console.log(''); | ||
console.log('Complex objects:'); | ||
console.log('Nested value objects:'); | ||
// complex tests | ||
logAndSave(test('Array', hashArray)); | ||
logAndSave(test('Function', hashFunction)); | ||
logAndSave(test('Map', hashMap)); | ||
logAndSave(test('Object', hashObject)); | ||
logAndSave(test('Object (recursive)', hashRecursiveObject)); | ||
logAndSave(test('RegExp', hashRegExp)); | ||
logAndSave(test('Set', hashSet)); | ||
@@ -71,0 +71,0 @@ |
@@ -174,3 +174,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
}); | ||
exports.getStringifiedValueWithRecursion = exports.getStringifiedValue = exports.tryCatch = exports.stringify = exports.getIntegerHashValue = exports.REPLACER = exports.getRecursiveStackValue = exports.getValueForStringification = exports.getStringifiedValueByObjectClass = exports.prependTypeToString = exports.getIterablePairs = exports.getObjectType = exports.arrayBufferToString = undefined; | ||
exports.getStringifiedValueWithRecursion = exports.getStringifiedValue = exports.tryCatch = exports.stringify = exports.getIntegerHashValue = exports.REPLACER = exports.getRecursiveStackValue = exports.getValueForStringification = exports.getStringifiedValueByObjectClass = exports.isNull = exports.prependTypeToString = exports.getIterablePairs = exports.getObjectType = exports.arrayBufferToString = undefined; | ||
@@ -249,2 +249,18 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; // external dependencies | ||
/** | ||
* is the object passed null | ||
* | ||
* @param {*} object | ||
* @returns {boolean} | ||
*/ | ||
var isNull = exports.isNull = function isNull(object) { | ||
return object === null; | ||
}; | ||
/** | ||
* get the stringified value of the object based based on its toString class | ||
* | ||
* @param {*} object | ||
* @returns {*} | ||
*/ | ||
var getStringifiedValueByObjectClass = exports.getStringifiedValueByObjectClass = function getStringifiedValueByObjectClass(object) { | ||
@@ -257,3 +273,3 @@ var type = (0, _toString.toString)(object); | ||
if (type === _constants.ERROR || type === _constants.REGEXP || object === null) { | ||
if (type === _constants.ERROR || type === _constants.REGEXP || isNull(object)) { | ||
return prependTypeToString(object, type); | ||
@@ -398,3 +414,3 @@ } | ||
if (type === _constants.DATE || type === _constants.MAP || type === _constants.SET || type === _constants.PROMISE || type === _constants.REGEXP || value === null || type === _constants.ERROR || type === _constants.GENERATOR || type === _constants.WEAKMAP || type === _constants.WEAKSET || type === _constants.MATH || type === _constants.ARRAY_BUFFER || type === _constants.DATA_VIEW || type === _constants.FLOAT_32_ARRAY || type === _constants.FLOAT_64_ARRAY || type === _constants.INT_8_ARRAY || type === _constants.INT_16_ARRAY || type === _constants.INT_32_ARRAY || type === _constants.UINT_8_ARRAY || type === _constants.UINT_8_CLAMPED_ARRAY || type === _constants.UINT_16_ARRAY || type === _constants.UINT_32_ARRAY) { | ||
if (type === _constants.DATE || type === _constants.MAP || type === _constants.SET || type === _constants.PROMISE || type === _constants.REGEXP || isNull(value) || type === _constants.ERROR || type === _constants.GENERATOR || type === _constants.WEAKMAP || type === _constants.WEAKSET || type === _constants.MATH || type === _constants.ARRAY_BUFFER || type === _constants.DATA_VIEW || type === _constants.FLOAT_32_ARRAY || type === _constants.FLOAT_64_ARRAY || type === _constants.INT_8_ARRAY || type === _constants.INT_16_ARRAY || type === _constants.INT_32_ARRAY || type === _constants.UINT_8_ARRAY || type === _constants.UINT_8_CLAMPED_ARRAY || type === _constants.UINT_16_ARRAY || type === _constants.UINT_32_ARRAY) { | ||
return getValueForStringification(value); | ||
@@ -401,0 +417,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("hashIt",[],e):"object"==typeof exports?exports.hashIt=e():t.hashIt=e()})(this,(function(){return (function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)})([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=function(t){var e=(0,r.getStringifiedValue)(t);return(0,r.getIntegerHashValue)(e)},i=o(void 0),u=o(null),f=o([]),A=o(new Map),c=o(0),E=o({}),a=o(new Set),R=o("");o.isEqual=function(){var t=arguments.length;if(1===t)throw new Error("isEqual requires at least two objects to be passed for comparison.");for(var e=0;++e<t;)if(o(arguments.length<=e-1?void 0:arguments[e-1])!==o(arguments.length<=e?void 0:arguments[e]))return!1;return!0},o.isEmpty=function(t){var e=o(t);return e===i||e===u||e===f||e===A||e===c||e===E||e===a||e===R},o.isNull=function(t){return o(t)===u},o.isUndefined=function(t){return o(t)===i},o.withRecursion=function(t){var e=(0,r.getStringifiedValueWithRecursion)(t);return(0,r.getIntegerHashValue)(e)},e.default=o,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.getStringifiedValueWithRecursion=e.getStringifiedValue=e.tryCatch=e.stringify=e.getIntegerHashValue=e.REPLACER=e.getRecursiveStackValue=e.getValueForStringification=e.getStringifiedValueByObjectClass=e.prependTypeToString=e.getIterablePairs=e.getObjectType=e.arrayBufferToString=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(3),u=r(i),f=n(5),A=n(4),c=e.arrayBufferToString=function(t){return("undefined"==typeof Uint16Array?"undefined":o(Uint16Array))===f.UNDEFINED_TYPEOF?"":String.fromCharCode.apply(null,new Uint16Array(t))},E=e.getObjectType=function(t){return t.slice(8,-1)},a=e.getIterablePairs=function(t,e){var n=[E(e)];return t.forEach((function(t,e){n.push([e,t])})),n},R=e.prependTypeToString=function(t,e){return E(e)+" "+t},T=e.getStringifiedValueByObjectClass=function(t){var e=(0,A.toString)(t);return e===f.ARRAY||e===f.OBJECT||e===f.ARGUMENTS?t:e===f.ERROR||e===f.REGEXP||null===t?R(t,e):e===f.DATE?R(t.valueOf(),e):e===f.MAP||e===f.SET?a(t,e):e===f.PROMISE||e===f.WEAKMAP||e===f.WEAKSET?R("NOT_ENUMERABLE",e):e===f.ARRAY_BUFFER?R(c(t),e):e===f.DATA_VIEW?R(c(t.buffer),e):e===f.FLOAT_32_ARRAY||e===f.FLOAT_64_ARRAY||e===f.INT_8_ARRAY||e===f.INT_16_ARRAY||e===f.INT_32_ARRAY||e===f.UINT_8_ARRAY||e===f.UINT_8_CLAMPED_ARRAY||e===f.UINT_16_ARRAY||e===f.UINT_32_ARRAY?R(t.join(","),e):e===f.MATH?f.MATH_OBJECT:f.HTML_ELEMENT_REGEXP.test(e)?"HTMLElement "+t.textContent:t},_=e.getValueForStringification=function(t){var e="undefined"==typeof t?"undefined":o(t);return e===f.STRING_TYPEOF||e===f.NUMBER_TYPEOF?t:e===f.BOOLEAN_TYPEOF||e===f.UNDEFINED_TYPEOF?R(t,(0,A.toString)(t)):e===f.FUNCTION_TYPEOF?(0,A.toFunctionString)(t,(0,A.toString)(t)===f.GENERATOR):e===f.SYMBOL_TYPEOF?t.toString():T(t)},l=e.getRecursiveStackValue=function(t,e,n,r,o){return t?o>255?"Undefined undefined":(r=n.indexOf(t),~r?"*Recursive-"+r:(n.push(t),t)):R(t,e)},d=e.REPLACER=(function(){var t=void 0,e=void 0,n=void 0,r=void 0;return function(i,u){return i?(r="undefined"==typeof u?"undefined":o(u),r===f.STRING_TYPEOF||r===f.NUMBER_TYPEOF||r===f.BOOLEAN_TYPEOF?u:r===f.UNDEFINED_TYPEOF||r===f.FUNCTION_TYPEOF?_(u):r===f.SYMBOL_TYPEOF?u.toString():(r=(0,A.toString)(u),r===f.ARRAY||r===f.OBJECT?l(u,r,t,n,++e):r===f.ARGUMENTS?u:r===f.DATE||r===f.MAP||r===f.SET||r===f.PROMISE||r===f.REGEXP||null===u||r===f.ERROR||r===f.GENERATOR||r===f.WEAKMAP||r===f.WEAKSET||r===f.MATH||r===f.ARRAY_BUFFER||r===f.DATA_VIEW||r===f.FLOAT_32_ARRAY||r===f.FLOAT_64_ARRAY||r===f.INT_8_ARRAY||r===f.INT_16_ARRAY||r===f.INT_32_ARRAY||r===f.UINT_8_ARRAY||r===f.UINT_8_CLAMPED_ARRAY||r===f.UINT_16_ARRAY||r===f.UINT_32_ARRAY?_(u):u)):(t=[u],e=0,u)}})(),s=(e.getIntegerHashValue=function(t){if(!t)return 0;for(var e=t.length,n=5381,r=-1;++r<e;)n=(n<<5)+n+t.charCodeAt(r);return n>>>0},e.stringify=function(t){return JSON.stringify(t,d)}),O=e.tryCatch=function(t){try{return s(t)}catch(e){return u.default.prune(t)}};e.getStringifiedValue=function(t){var e=_(t);return("undefined"==typeof e?"undefined":o(e))===f.STRING_TYPEOF?e:s(e)},e.getStringifiedValueWithRecursion=function(t){var e=_(t);return("undefined"==typeof e?"undefined":o(e))===f.STRING_TYPEOF?e:O(_(t))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=n(4),i=n(5),u=void 0,f=function(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n)},A=function(t){i.ESCAPABLE.lastIndex=0;var e=void 0;return i.ESCAPABLE.test(t)?'"'+t.replace(i.ESCAPABLE,(function(t){return e=i.META[t],(0,o.toString)(e)===o.STRING?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+t+'"'},c=function(t){u=[];var e=function t(e,n,c){var E=n[e],a="undefined"==typeof E?"undefined":r(E),R=[],T=void 0;if(a===i.STRING_TYPEOF)return A(E);if(a===i.BOOLEAN_TYPEOF||a===i.NUMBER_TYPEOF||a===i.UNDEFINED_TYPEOF)return""+E;if(a===i.FUNCTION_TYPEOF)return(0,o.toFunctionString)(E);if(!E)return""+E;var _=u.indexOf(E);if(c<=0||~_)return i.DEFAULT_PRUNED_VALUE+"-"+_;if(a=(0,o.toString)(E),a===o.ARRAY){u.push(E);for(var l=Math.min(E.length,i.DEFAULT_ARRAY_MAX_LENGTH),d=-1;++d<l;)R[d]=t(d,E,c-1);return T="["+R.join(",")+"]"}return a===o.DATE?""+E.valueOf():(u.push(E),f(E,(function(e){try{T=t(e,E,c-1),T&&R.push(A(e)+":"+T)}catch(t){}})),"{"+R.join(",")+"}")};return e("",{"":t},i.DEFAULT_MAX_DEPTH)};e.default={prune:c},t.exports=e.default},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Object.prototype.toString,r=e.getFunctionArgs=function(t){for(var e="",n=-1;++n<t;)e+="arg,";return e.slice(0,-1)};e.toFunctionString=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"function"+(e?"*":"")+" "+(t.name||"anonymous")+"("+r(t.length)+"){}"},e.toString=function(t){return n.call(t)}},function(t,e){"use strict";function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.ARGUMENTS="[object Arguments]",e.ARRAY="[object Array]",e.ARRAY_BUFFER="[object ArrayBuffer]",e.DATA_VIEW="[object DataView]",e.DATE="[object Date]",e.ERROR="[object Error]",e.FLOAT_32_ARRAY="[object Float32Array]",e.FLOAT_64_ARRAY="[object Float64Array]",e.GENERATOR="[object GeneratorFunction]",e.INT_8_ARRAY="[object Int8Array]",e.INT_16_ARRAY="[object Int16Array]",e.INT_32_ARRAY="[object Int32Array]",e.MAP="[object Map]",e.MATH="[object Math]",e.OBJECT="[object Object]",e.PROMISE="[object Promise]",e.REGEXP="[object RegExp]",e.SET="[object Set]",e.STRING="[object String]",e.UINT_8_ARRAY="[object Uint8Array]",e.UINT_8_CLAMPED_ARRAY="[object Uint8ClampedArray]",e.UINT_16_ARRAY="[object Uint16Array]",e.UINT_32_ARRAY="[object Uint32Array]",e.WEAKMAP="[object WeakMap]",e.WEAKSET="[object WeakSet]",e.BOOLEAN_TYPEOF="boolean",e.FUNCTION_TYPEOF="function",e.NUMBER_TYPEOF="number",e.STRING_TYPEOF="string",e.SYMBOL_TYPEOF="symbol",e.UNDEFINED_TYPEOF="undefined",e.DEFAULT_MAX_DEPTH=6,e.DEFAULT_ARRAY_MAX_LENGTH=50,e.DEFAULT_PRUNED_VALUE="*Recursive",e.ESCAPABLE=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e.META={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},e.HTML_ELEMENT_REGEXP=/\[object (HTML(.*)Element)\]/,e.MATH_OBJECT=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2"].reduce((function(t,e){return r({},t,n({},e,Math[e]))}),{})}])})); | ||
!(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("hashIt",[],e):"object"==typeof exports?exports.hashIt=e():t.hashIt=e()})(this,(function(){return (function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)})([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=function(t){var e=(0,r.getStringifiedValue)(t);return(0,r.getIntegerHashValue)(e)},i=o(void 0),u=o(null),f=o([]),A=o(new Map),c=o(0),E=o({}),a=o(new Set),R=o("");o.isEqual=function(){var t=arguments.length;if(1===t)throw new Error("isEqual requires at least two objects to be passed for comparison.");for(var e=0;++e<t;)if(o(arguments.length<=e-1?void 0:arguments[e-1])!==o(arguments.length<=e?void 0:arguments[e]))return!1;return!0},o.isEmpty=function(t){var e=o(t);return e===i||e===u||e===f||e===A||e===c||e===E||e===a||e===R},o.isNull=function(t){return o(t)===u},o.isUndefined=function(t){return o(t)===i},o.withRecursion=function(t){var e=(0,r.getStringifiedValueWithRecursion)(t);return(0,r.getIntegerHashValue)(e)},e.default=o,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.getStringifiedValueWithRecursion=e.getStringifiedValue=e.tryCatch=e.stringify=e.getIntegerHashValue=e.REPLACER=e.getRecursiveStackValue=e.getValueForStringification=e.getStringifiedValueByObjectClass=e.isNull=e.prependTypeToString=e.getIterablePairs=e.getObjectType=e.arrayBufferToString=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(3),u=r(i),f=n(5),A=n(4),c=e.arrayBufferToString=function(t){return("undefined"==typeof Uint16Array?"undefined":o(Uint16Array))===f.UNDEFINED_TYPEOF?"":String.fromCharCode.apply(null,new Uint16Array(t))},E=e.getObjectType=function(t){return t.slice(8,-1)},a=e.getIterablePairs=function(t,e){var n=[E(e)];return t.forEach((function(t,e){n.push([e,t])})),n},R=e.prependTypeToString=function(t,e){return E(e)+" "+t},T=e.isNull=function(t){return null===t},_=e.getStringifiedValueByObjectClass=function(t){var e=(0,A.toString)(t);return e===f.ARRAY||e===f.OBJECT||e===f.ARGUMENTS?t:e===f.ERROR||e===f.REGEXP||T(t)?R(t,e):e===f.DATE?R(t.valueOf(),e):e===f.MAP||e===f.SET?a(t,e):e===f.PROMISE||e===f.WEAKMAP||e===f.WEAKSET?R("NOT_ENUMERABLE",e):e===f.ARRAY_BUFFER?R(c(t),e):e===f.DATA_VIEW?R(c(t.buffer),e):e===f.FLOAT_32_ARRAY||e===f.FLOAT_64_ARRAY||e===f.INT_8_ARRAY||e===f.INT_16_ARRAY||e===f.INT_32_ARRAY||e===f.UINT_8_ARRAY||e===f.UINT_8_CLAMPED_ARRAY||e===f.UINT_16_ARRAY||e===f.UINT_32_ARRAY?R(t.join(","),e):e===f.MATH?f.MATH_OBJECT:f.HTML_ELEMENT_REGEXP.test(e)?"HTMLElement "+t.textContent:t},l=e.getValueForStringification=function(t){var e="undefined"==typeof t?"undefined":o(t);return e===f.STRING_TYPEOF||e===f.NUMBER_TYPEOF?t:e===f.BOOLEAN_TYPEOF||e===f.UNDEFINED_TYPEOF?R(t,(0,A.toString)(t)):e===f.FUNCTION_TYPEOF?(0,A.toFunctionString)(t,(0,A.toString)(t)===f.GENERATOR):e===f.SYMBOL_TYPEOF?t.toString():_(t)},d=e.getRecursiveStackValue=function(t,e,n,r,o){return t?o>255?"Undefined undefined":(r=n.indexOf(t),~r?"*Recursive-"+r:(n.push(t),t)):R(t,e)},s=e.REPLACER=(function(){var t=void 0,e=void 0,n=void 0,r=void 0;return function(i,u){return i?(r="undefined"==typeof u?"undefined":o(u),r===f.STRING_TYPEOF||r===f.NUMBER_TYPEOF||r===f.BOOLEAN_TYPEOF?u:r===f.UNDEFINED_TYPEOF||r===f.FUNCTION_TYPEOF?l(u):r===f.SYMBOL_TYPEOF?u.toString():(r=(0,A.toString)(u),r===f.ARRAY||r===f.OBJECT?d(u,r,t,n,++e):r===f.ARGUMENTS?u:r===f.DATE||r===f.MAP||r===f.SET||r===f.PROMISE||r===f.REGEXP||T(u)||r===f.ERROR||r===f.GENERATOR||r===f.WEAKMAP||r===f.WEAKSET||r===f.MATH||r===f.ARRAY_BUFFER||r===f.DATA_VIEW||r===f.FLOAT_32_ARRAY||r===f.FLOAT_64_ARRAY||r===f.INT_8_ARRAY||r===f.INT_16_ARRAY||r===f.INT_32_ARRAY||r===f.UINT_8_ARRAY||r===f.UINT_8_CLAMPED_ARRAY||r===f.UINT_16_ARRAY||r===f.UINT_32_ARRAY?l(u):u)):(t=[u],e=0,u)}})(),O=(e.getIntegerHashValue=function(t){if(!t)return 0;for(var e=t.length,n=5381,r=-1;++r<e;)n=(n<<5)+n+t.charCodeAt(r);return n>>>0},e.stringify=function(t){return JSON.stringify(t,s)}),y=e.tryCatch=function(t){try{return O(t)}catch(e){return u.default.prune(t)}};e.getStringifiedValue=function(t){var e=l(t);return("undefined"==typeof e?"undefined":o(e))===f.STRING_TYPEOF?e:O(e)},e.getStringifiedValueWithRecursion=function(t){var e=l(t);return("undefined"==typeof e?"undefined":o(e))===f.STRING_TYPEOF?e:y(l(t))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=n(4),i=n(5),u=void 0,f=function(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n)},A=function(t){i.ESCAPABLE.lastIndex=0;var e=void 0;return i.ESCAPABLE.test(t)?'"'+t.replace(i.ESCAPABLE,(function(t){return e=i.META[t],(0,o.toString)(e)===o.STRING?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+t+'"'},c=function(t){u=[];var e=function t(e,n,c){var E=n[e],a="undefined"==typeof E?"undefined":r(E),R=[],T=void 0;if(a===i.STRING_TYPEOF)return A(E);if(a===i.BOOLEAN_TYPEOF||a===i.NUMBER_TYPEOF||a===i.UNDEFINED_TYPEOF)return""+E;if(a===i.FUNCTION_TYPEOF)return(0,o.toFunctionString)(E);if(!E)return""+E;var _=u.indexOf(E);if(c<=0||~_)return i.DEFAULT_PRUNED_VALUE+"-"+_;if(a=(0,o.toString)(E),a===o.ARRAY){u.push(E);for(var l=Math.min(E.length,i.DEFAULT_ARRAY_MAX_LENGTH),d=-1;++d<l;)R[d]=t(d,E,c-1);return T="["+R.join(",")+"]"}return a===o.DATE?""+E.valueOf():(u.push(E),f(E,(function(e){try{T=t(e,E,c-1),T&&R.push(A(e)+":"+T)}catch(t){}})),"{"+R.join(",")+"}")};return e("",{"":t},i.DEFAULT_MAX_DEPTH)};e.default={prune:c},t.exports=e.default},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Object.prototype.toString,r=e.getFunctionArgs=function(t){for(var e="",n=-1;++n<t;)e+="arg,";return e.slice(0,-1)};e.toFunctionString=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"function"+(e?"*":"")+" "+(t.name||"anonymous")+"("+r(t.length)+"){}"},e.toString=function(t){return n.call(t)}},function(t,e){"use strict";function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.ARGUMENTS="[object Arguments]",e.ARRAY="[object Array]",e.ARRAY_BUFFER="[object ArrayBuffer]",e.DATA_VIEW="[object DataView]",e.DATE="[object Date]",e.ERROR="[object Error]",e.FLOAT_32_ARRAY="[object Float32Array]",e.FLOAT_64_ARRAY="[object Float64Array]",e.GENERATOR="[object GeneratorFunction]",e.INT_8_ARRAY="[object Int8Array]",e.INT_16_ARRAY="[object Int16Array]",e.INT_32_ARRAY="[object Int32Array]",e.MAP="[object Map]",e.MATH="[object Math]",e.OBJECT="[object Object]",e.PROMISE="[object Promise]",e.REGEXP="[object RegExp]",e.SET="[object Set]",e.STRING="[object String]",e.UINT_8_ARRAY="[object Uint8Array]",e.UINT_8_CLAMPED_ARRAY="[object Uint8ClampedArray]",e.UINT_16_ARRAY="[object Uint16Array]",e.UINT_32_ARRAY="[object Uint32Array]",e.WEAKMAP="[object WeakMap]",e.WEAKSET="[object WeakSet]",e.BOOLEAN_TYPEOF="boolean",e.FUNCTION_TYPEOF="function",e.NUMBER_TYPEOF="number",e.STRING_TYPEOF="string",e.SYMBOL_TYPEOF="symbol",e.UNDEFINED_TYPEOF="undefined",e.DEFAULT_MAX_DEPTH=6,e.DEFAULT_ARRAY_MAX_LENGTH=50,e.DEFAULT_PRUNED_VALUE="*Recursive",e.ESCAPABLE=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e.META={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},e.HTML_ELEMENT_REGEXP=/\[object (HTML(.*)Element)\]/,e.MATH_OBJECT=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2"].reduce((function(t,e){return r({},t,n({},e,Math[e]))}),{})}])})); |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.getStringifiedValueWithRecursion = exports.getStringifiedValue = exports.tryCatch = exports.stringify = exports.getIntegerHashValue = exports.REPLACER = exports.getRecursiveStackValue = exports.getValueForStringification = exports.getStringifiedValueByObjectClass = exports.prependTypeToString = exports.getIterablePairs = exports.getObjectType = exports.arrayBufferToString = undefined; | ||
exports.getStringifiedValueWithRecursion = exports.getStringifiedValue = exports.tryCatch = exports.stringify = exports.getIntegerHashValue = exports.REPLACER = exports.getRecursiveStackValue = exports.getValueForStringification = exports.getStringifiedValueByObjectClass = exports.isNull = exports.prependTypeToString = exports.getIterablePairs = exports.getObjectType = exports.arrayBufferToString = undefined; | ||
@@ -81,2 +81,18 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; // external dependencies | ||
/** | ||
* is the object passed null | ||
* | ||
* @param {*} object | ||
* @returns {boolean} | ||
*/ | ||
var isNull = exports.isNull = function isNull(object) { | ||
return object === null; | ||
}; | ||
/** | ||
* get the stringified value of the object based based on its toString class | ||
* | ||
* @param {*} object | ||
* @returns {*} | ||
*/ | ||
var getStringifiedValueByObjectClass = exports.getStringifiedValueByObjectClass = function getStringifiedValueByObjectClass(object) { | ||
@@ -89,3 +105,3 @@ var type = (0, _toString.toString)(object); | ||
if (type === _constants.ERROR || type === _constants.REGEXP || object === null) { | ||
if (type === _constants.ERROR || type === _constants.REGEXP || isNull(object)) { | ||
return prependTypeToString(object, type); | ||
@@ -230,3 +246,3 @@ } | ||
if (type === _constants.DATE || type === _constants.MAP || type === _constants.SET || type === _constants.PROMISE || type === _constants.REGEXP || value === null || type === _constants.ERROR || type === _constants.GENERATOR || type === _constants.WEAKMAP || type === _constants.WEAKSET || type === _constants.MATH || type === _constants.ARRAY_BUFFER || type === _constants.DATA_VIEW || type === _constants.FLOAT_32_ARRAY || type === _constants.FLOAT_64_ARRAY || type === _constants.INT_8_ARRAY || type === _constants.INT_16_ARRAY || type === _constants.INT_32_ARRAY || type === _constants.UINT_8_ARRAY || type === _constants.UINT_8_CLAMPED_ARRAY || type === _constants.UINT_16_ARRAY || type === _constants.UINT_32_ARRAY) { | ||
if (type === _constants.DATE || type === _constants.MAP || type === _constants.SET || type === _constants.PROMISE || type === _constants.REGEXP || isNull(value) || type === _constants.ERROR || type === _constants.GENERATOR || type === _constants.WEAKMAP || type === _constants.WEAKSET || type === _constants.MATH || type === _constants.ARRAY_BUFFER || type === _constants.DATA_VIEW || type === _constants.FLOAT_32_ARRAY || type === _constants.FLOAT_64_ARRAY || type === _constants.INT_8_ARRAY || type === _constants.INT_16_ARRAY || type === _constants.INT_32_ARRAY || type === _constants.UINT_8_ARRAY || type === _constants.UINT_8_CLAMPED_ARRAY || type === _constants.UINT_16_ARRAY || type === _constants.UINT_32_ARRAY) { | ||
return getValueForStringification(value); | ||
@@ -233,0 +249,0 @@ } |
@@ -90,3 +90,3 @@ { | ||
}, | ||
"version": "2.1.0" | ||
"version": "2.1.1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
415320
1388