Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hash-it

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hash-it - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

41

dist/hash-it.js

@@ -136,2 +136,7 @@ var hashIt =

case _toString.types.DATA_VIEW:
return {
v: arrayBufferToString(object.buffer)
};
case _toString.types.FLOAT_32_ARRAY:

@@ -160,2 +165,7 @@ case _toString.types.FLOAT_64_ARRAY:

case _toString.types.GENERATOR:
return {
v: (0, _toString.toFunctionString)(object, true)
};
case _toString.types.ERROR:

@@ -197,2 +207,7 @@ case _toString.types.NULL:

case _toString.types.PROMISE:
return {
v: 'Promise--NOT_ENUMERABLE'
};
case _toString.types.WEAKMAP:

@@ -232,4 +247,12 @@ return {

switch ((0, _toString.toString)(value)) {
case _toString.types.ARRAY_BUFFER:
case _toString.types.DATA_VIEW:
case _toString.types.DATE:
case _toString.types.FLOAT_32_ARRAY:
case _toString.types.FLOAT_64_ARRAY:
case _toString.types.FUNCTION:
case _toString.types.GENERATOR:
case _toString.types.INT_8_ARRAY:
case _toString.types.INT_16_ARRAY:
case _toString.types.INT_32_ARRAY:
case _toString.types.ERROR:

@@ -239,8 +262,13 @@ case _toString.types.MAP:

case _toString.types.NULL:
case _toString.types.PROMISE:
case _toString.types.REGEXP:
case _toString.types.SET:
case _toString.types.SYMBOL:
case _toString.types.UINT_8_ARRAY:
case _toString.types.UINT_8_CLAMPED_ARRAY:
case _toString.types.UINT_16_ARRAY:
case _toString.types.UINT_32_ARRAY:
case _toString.types.UNDEFINED:
case _toString.types.WEAKMAP:
case _toString.types.WEAKSET:
case _toString.types.UNDEFINED:
return getValueForStringification(value);

@@ -490,2 +518,3 @@

var BOOLEAN = '[object Boolean]';
var DATA_VIEW = '[object DataView]';
var DATE = '[object Date]';

@@ -496,2 +525,3 @@ var ERROR = '[object Error]';

var FUNCTION = '[object Function]';
var GENERATOR = '[object GeneratorFunction]';
var INT_8_ARRAY = '[object Int8Array]';

@@ -505,2 +535,3 @@ var INT_16_ARRAY = '[object Int16Array]';

var OBJECT = '[object Object]';
var PROMISE = '[object Promise]';
var REGEXP = '[object RegExp]';

@@ -523,2 +554,3 @@ var SET = '[object Set]';

BOOLEAN: BOOLEAN,
DATA_VIEW: DATA_VIEW,
DATE: DATE,

@@ -529,2 +561,3 @@ ERROR: ERROR,

FUNCTION: FUNCTION,
GENERATOR: GENERATOR,
INT_8_ARRAY: INT_8_ARRAY,

@@ -538,2 +571,3 @@ INT_16_ARRAY: INT_16_ARRAY,

OBJECT: OBJECT,
PROMISE: PROMISE,
REGEXP: REGEXP,

@@ -557,6 +591,9 @@ SET: SET,

* @param {function} fn
* @param {boolean} isGenerator=false
* @returns {string}
*/
var toFunctionString = function toFunctionString(fn) {
return 'function ' + (fn.name || 'anonymous') + '(' + new Array(fn.length + 1).join(',arg').slice(1) + '){}';
var isGenerator = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
return 'function' + (isGenerator ? '*' : '') + ' ' + (fn.name || 'anonymous') + '(' + new Array(fn.length + 1).join(',arg').slice(1) + '){}';
};

@@ -563,0 +600,0 @@

2

dist/hash-it.min.js

@@ -1,1 +0,1 @@

var hashIt=function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";t.__esModule=!0;var n=r(2),o=function(e){return(0,n.getIntegerHashValue)((0,n.stringify)(e))};t.default=o,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0,t.stringify=t.replacer=t.getIntegerHashValue=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},c=r(3),u=n(c),s=r(4),a=/\[object (HTML(.*)Element)\]/,i=function(e){return"undefined"==typeof Uint16Array?"":String.fromCharCode.apply(null,new Uint16Array(e))},f=function(e){return e.replace(/^\[object (.+)\]$/,"$1")},y=function(e){var t=(0,s.toString)(e),r=function(){switch(t){case s.types.ARRAY_BUFFER:return{v:i(e)};case s.types.FLOAT_32_ARRAY:case s.types.FLOAT_64_ARRAY:case s.types.INT_8_ARRAY:case s.types.INT_16_ARRAY:case s.types.INT_32_ARRAY:case s.types.UINT_8_ARRAY:case s.types.UINT_8_CLAMPED_ARRAY:case s.types.UINT_16_ARRAY:case s.types.UINT_32_ARRAY:return{v:f(t)+" ["+e.join(",")+"]"};case s.types.DATE:return{v:""+e.valueOf()};case s.types.FUNCTION:return{v:(0,s.toFunctionString)(e)};case s.types.ERROR:case s.types.NULL:case s.types.NUMBER:case s.types.REGEXP:case s.types.UNDEFINED:return{v:""+e};case s.types.MAP:case s.types.SET:var r=[];return e.forEach(function(e,t){r.push([t,e])}),{v:r};case s.types.OBJECT:return{v:e?e:""+e};case s.types.SYMBOL:return{v:e.toString()};case s.types.MATH:return{v:"Math--NOT_ENUMERABLE"};case s.types.WEAKMAP:return{v:"WeakMap--NOT_ENUMERABLE"};case s.types.WEAKSET:return{v:"WeakSet--NOT_ENUMERABLE"};default:return{v:a.test(t)?e.textContent:e}}}();if("object"===("undefined"==typeof r?"undefined":o(r)))return r.v},A=function(e,t,r,n){return function(t,o){if(""===t)return e=[o],r=0,o;switch((0,s.toString)(o)){case s.types.DATE:case s.types.FUNCTION:case s.types.ERROR:case s.types.MAP:case s.types.MATH:case s.types.NULL:case s.types.REGEXP:case s.types.SET:case s.types.SYMBOL:case s.types.WEAKMAP:case s.types.WEAKSET:case s.types.UNDEFINED:return y(o);case s.types.ARRAY:case s.types.OBJECT:return o?++r>255?"undefined":(n=e.indexOf(o),~n?"*Recursive-"+n:(e.push(o),o)):""+o;default:return o}}}(),p=function(e){if(!e)return 0;for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0},R=function(e){try{return JSON.stringify(e,A)}catch(t){return u.default.prune(e)}},l=function(e){var t=y(e);return R(t)};t.getIntegerHashValue=p,t.replacer=A,t.stringify=l},function(e,t,r){"use strict";t.__esModule=!0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=r(4),c=6,u=50,s="*Recursive",a=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},f=void 0,y=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(r)},A=function(e){a.lastIndex=0;var t=void 0;return a.test(e)?'"'+e.replace(a,function(e){return t=i[e],(0,o.toString)(t)===o.types.STRING?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'},p=function(e){f=[];var t=function r(e,t,c){var a=t[e],i=[],p=void 0;switch("undefined"==typeof a?"undefined":n(a)){case"string":return A(a);case"boolean":case"null":case"number":case"undefined":return""+a;case"function":return(0,o.toFunctionString)(a);case"object":if(!a)return""+a;var R=f.indexOf(a);if(c<=0||~R)return s+"-"+R;switch((0,o.toString)(a)){case o.types.ARRAY:f.push(a);for(var l=Math.min(a.length,u),b=-1;++b<l;)i[b]=r(b,a,c-1);return p="["+i.join(",")+"]";case o.types.DATE:return""+a.valueOf();default:return f.push(a),y(a,function(e){try{p=r(e,a,c-1),p&&i.push(A(e)+":"+p)}catch(t){}}),"{"+i.join(",")+"}"}}};return t("",{"":e},c)};t.default={prune:p},e.exports=t.default},function(e,t){"use strict";t.__esModule=!0;var r="[object Array]",n="[object ArrayBuffer]",o="[object Boolean]",c="[object Date]",u="[object Error]",s="[object Float32Array]",a="[object Float64Array]",i="[object Function]",f="[object Int8Array]",y="[object Int16Array]",A="[object Int32Array]",p="[object Map]",R="[object Math]",l="[object Null]",b="[object Number]",E="[object Object]",_="[object RegExp]",d="[object Set]",N="[object String]",T="[object Symbol]",j="[object Uint8Array]",v="[object Uint8ClampedArray]",S="[object Uint16Array]",I="[object Uint32Array]",M="[object Undefined]",O="[object WeakMap]",U="[object WeakSet]",g="[object Window]",h={ARRAY:r,ARRAY_BUFFER:n,BOOLEAN:o,DATE:c,ERROR:u,FLOAT_32_ARRAY:s,FLOAT_64_ARRAY:a,FUNCTION:i,INT_8_ARRAY:f,INT_16_ARRAY:y,INT_32_ARRAY:A,MAP:p,MATH:R,NULL:l,NUMBER:b,OBJECT:E,REGEXP:_,SET:d,STRING:N,SYMBOL:T,UINT_8_ARRAY:j,UINT_8_CLAMPED_ARRAY:v,UINT_16_ARRAY:S,UINT_32_ARRAY:I,UNDEFINED:M,WEAKMAP:O,WEAKSET:U,WINDOW:g},Y=function(e){return"function "+(e.name||"anonymous")+"("+new Array(e.length+1).join(",arg").slice(1)+"){}"},m=function(e){return Object.prototype.toString.call(e)};t.toFunctionString=Y,t.toString=m,t.types=h}]);
var hashIt=function(e){function t(n){if(r[n])return r[n].exports;var s=r[n]={exports:{},id:n,loaded:!1};return e[n].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";t.__esModule=!0;var n=r(2),s=function(e){return(0,n.getIntegerHashValue)((0,n.stringify)(e))};t.default=s,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0,t.stringify=t.replacer=t.getIntegerHashValue=void 0;var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},c=r(3),o=n(c),u=r(4),a=/\[object (HTML(.*)Element)\]/,A=function(e){return"undefined"==typeof Uint16Array?"":String.fromCharCode.apply(null,new Uint16Array(e))},i=function(e){return e.replace(/^\[object (.+)\]$/,"$1")},y=function(e){var t=(0,u.toString)(e),r=function(){switch(t){case u.types.ARRAY_BUFFER:return{v:A(e)};case u.types.DATA_VIEW:return{v:A(e.buffer)};case u.types.FLOAT_32_ARRAY:case u.types.FLOAT_64_ARRAY:case u.types.INT_8_ARRAY:case u.types.INT_16_ARRAY:case u.types.INT_32_ARRAY:case u.types.UINT_8_ARRAY:case u.types.UINT_8_CLAMPED_ARRAY:case u.types.UINT_16_ARRAY:case u.types.UINT_32_ARRAY:return{v:i(t)+" ["+e.join(",")+"]"};case u.types.DATE:return{v:""+e.valueOf()};case u.types.FUNCTION:return{v:(0,u.toFunctionString)(e)};case u.types.GENERATOR:return{v:(0,u.toFunctionString)(e,!0)};case u.types.ERROR:case u.types.NULL:case u.types.NUMBER:case u.types.REGEXP:case u.types.UNDEFINED:return{v:""+e};case u.types.MAP:case u.types.SET:var r=[];return e.forEach(function(e,t){r.push([t,e])}),{v:r};case u.types.OBJECT:return{v:e?e:""+e};case u.types.SYMBOL:return{v:e.toString()};case u.types.MATH:return{v:"Math--NOT_ENUMERABLE"};case u.types.PROMISE:return{v:"Promise--NOT_ENUMERABLE"};case u.types.WEAKMAP:return{v:"WeakMap--NOT_ENUMERABLE"};case u.types.WEAKSET:return{v:"WeakSet--NOT_ENUMERABLE"};default:return{v:a.test(t)?e.textContent:e}}}();if("object"===("undefined"==typeof r?"undefined":s(r)))return r.v},f=function(e,t,r,n){return function(t,s){if(""===t)return e=[s],r=0,s;switch((0,u.toString)(s)){case u.types.ARRAY_BUFFER:case u.types.DATA_VIEW:case u.types.DATE:case u.types.FLOAT_32_ARRAY:case u.types.FLOAT_64_ARRAY:case u.types.FUNCTION:case u.types.GENERATOR:case u.types.INT_8_ARRAY:case u.types.INT_16_ARRAY:case u.types.INT_32_ARRAY:case u.types.ERROR:case u.types.MAP:case u.types.MATH:case u.types.NULL:case u.types.PROMISE:case u.types.REGEXP:case u.types.SET:case u.types.SYMBOL:case u.types.UINT_8_ARRAY:case u.types.UINT_8_CLAMPED_ARRAY:case u.types.UINT_16_ARRAY:case u.types.UINT_32_ARRAY:case u.types.UNDEFINED:case u.types.WEAKMAP:case u.types.WEAKSET:return y(s);case u.types.ARRAY:case u.types.OBJECT:return s?++r>255?"undefined":(n=e.indexOf(s),~n?"*Recursive-"+n:(e.push(s),s)):""+s;default:return s}}}(),p=function(e){if(!e)return 0;for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0},R=function(e){try{return JSON.stringify(e,f)}catch(t){return o.default.prune(e)}},_=function(e){var t=y(e);return R(t)};t.getIntegerHashValue=p,t.replacer=f,t.stringify=_},function(e,t,r){"use strict";t.__esModule=!0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},s=r(4),c=6,o=50,u="*Recursive",a=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,A={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},i=void 0,y=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(r)},f=function(e){a.lastIndex=0;var t=void 0;return a.test(e)?'"'+e.replace(a,function(e){return t=A[e],(0,s.toString)(t)===s.types.STRING?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'},p=function(e){i=[];var t=function r(e,t,c){var a=t[e],A=[],p=void 0;switch("undefined"==typeof a?"undefined":n(a)){case"string":return f(a);case"boolean":case"null":case"number":case"undefined":return""+a;case"function":return(0,s.toFunctionString)(a);case"object":if(!a)return""+a;var R=i.indexOf(a);if(c<=0||~R)return u+"-"+R;switch((0,s.toString)(a)){case s.types.ARRAY:i.push(a);for(var _=Math.min(a.length,o),E=-1;++E<_;)A[E]=r(E,a,c-1);return p="["+A.join(",")+"]";case s.types.DATE:return""+a.valueOf();default:return i.push(a),y(a,function(e){try{p=r(e,a,c-1),p&&A.push(f(e)+":"+p)}catch(t){}}),"{"+A.join(",")+"}"}}};return t("",{"":e},c)};t.default={prune:p},e.exports=t.default},function(e,t){"use strict";t.__esModule=!0;var r="[object Array]",n="[object ArrayBuffer]",s="[object Boolean]",c="[object DataView]",o="[object Date]",u="[object Error]",a="[object Float32Array]",A="[object Float64Array]",i="[object Function]",y="[object GeneratorFunction]",f="[object Int8Array]",p="[object Int16Array]",R="[object Int32Array]",_="[object Map]",E="[object Math]",l="[object Null]",T="[object Number]",b="[object Object]",N="[object Promise]",d="[object RegExp]",I="[object Set]",v="[object String]",j="[object Symbol]",S="[object Uint8Array]",O="[object Uint8ClampedArray]",U="[object Uint16Array]",M="[object Uint32Array]",Y="[object Undefined]",g="[object WeakMap]",h="[object WeakSet]",F="[object Window]",m={ARRAY:r,ARRAY_BUFFER:n,BOOLEAN:s,DATA_VIEW:c,DATE:o,ERROR:u,FLOAT_32_ARRAY:a,FLOAT_64_ARRAY:A,FUNCTION:i,GENERATOR:y,INT_8_ARRAY:f,INT_16_ARRAY:p,INT_32_ARRAY:R,MAP:_,MATH:E,NULL:l,NUMBER:T,OBJECT:b,PROMISE:N,REGEXP:d,SET:I,STRING:v,SYMBOL:j,UINT_8_ARRAY:S,UINT_8_CLAMPED_ARRAY:O,UINT_16_ARRAY:U,UINT_32_ARRAY:M,UNDEFINED:Y,WEAKMAP:g,WEAKSET:h,WINDOW:F},L=function(e){var t=!(arguments.length<=1||void 0===arguments[1])&&arguments[1];return"function"+(t?"*":"")+" "+(e.name||"anonymous")+"("+new Array(e.length+1).join(",arg").slice(1)+"){}"},D=function(e){return Object.prototype.toString.call(e)};t.toFunctionString=L,t.toString=D,t.types=m}]);

@@ -7,2 +7,3 @@ 'use strict';

var BOOLEAN = '[object Boolean]';
var DATA_VIEW = '[object DataView]';
var DATE = '[object Date]';

@@ -13,2 +14,3 @@ var ERROR = '[object Error]';

var FUNCTION = '[object Function]';
var GENERATOR = '[object GeneratorFunction]';
var INT_8_ARRAY = '[object Int8Array]';

@@ -22,2 +24,3 @@ var INT_16_ARRAY = '[object Int16Array]';

var OBJECT = '[object Object]';
var PROMISE = '[object Promise]';
var REGEXP = '[object RegExp]';

@@ -40,2 +43,3 @@ var SET = '[object Set]';

BOOLEAN: BOOLEAN,
DATA_VIEW: DATA_VIEW,
DATE: DATE,

@@ -46,2 +50,3 @@ ERROR: ERROR,

FUNCTION: FUNCTION,
GENERATOR: GENERATOR,
INT_8_ARRAY: INT_8_ARRAY,

@@ -55,2 +60,3 @@ INT_16_ARRAY: INT_16_ARRAY,

OBJECT: OBJECT,
PROMISE: PROMISE,
REGEXP: REGEXP,

@@ -74,6 +80,9 @@ SET: SET,

* @param {function} fn
* @param {boolean} isGenerator=false
* @returns {string}
*/
var toFunctionString = function toFunctionString(fn) {
return 'function ' + (fn.name || 'anonymous') + '(' + new Array(fn.length + 1).join(',arg').slice(1) + '){}';
var isGenerator = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
return 'function' + (isGenerator ? '*' : '') + ' ' + (fn.name || 'anonymous') + '(' + new Array(fn.length + 1).join(',arg').slice(1) + '){}';
};

@@ -80,0 +89,0 @@

@@ -59,2 +59,7 @@ 'use strict';

case _toString.types.DATA_VIEW:
return {
v: arrayBufferToString(object.buffer)
};
case _toString.types.FLOAT_32_ARRAY:

@@ -83,2 +88,7 @@ case _toString.types.FLOAT_64_ARRAY:

case _toString.types.GENERATOR:
return {
v: (0, _toString.toFunctionString)(object, true)
};
case _toString.types.ERROR:

@@ -120,2 +130,7 @@ case _toString.types.NULL:

case _toString.types.PROMISE:
return {
v: 'Promise--NOT_ENUMERABLE'
};
case _toString.types.WEAKMAP:

@@ -155,4 +170,12 @@ return {

switch ((0, _toString.toString)(value)) {
case _toString.types.ARRAY_BUFFER:
case _toString.types.DATA_VIEW:
case _toString.types.DATE:
case _toString.types.FLOAT_32_ARRAY:
case _toString.types.FLOAT_64_ARRAY:
case _toString.types.FUNCTION:
case _toString.types.GENERATOR:
case _toString.types.INT_8_ARRAY:
case _toString.types.INT_16_ARRAY:
case _toString.types.INT_32_ARRAY:
case _toString.types.ERROR:

@@ -162,8 +185,13 @@ case _toString.types.MAP:

case _toString.types.NULL:
case _toString.types.PROMISE:
case _toString.types.REGEXP:
case _toString.types.SET:
case _toString.types.SYMBOL:
case _toString.types.UINT_8_ARRAY:
case _toString.types.UINT_8_CLAMPED_ARRAY:
case _toString.types.UINT_16_ARRAY:
case _toString.types.UINT_32_ARRAY:
case _toString.types.UNDEFINED:
case _toString.types.WEAKMAP:
case _toString.types.WEAKSET:
case _toString.types.UNDEFINED:
return getValueForStringification(value);

@@ -170,0 +198,0 @@

{
"author": "planttheidea",
"ava": {
"babel": "inherit",
"babel": {
"babelrc": true,
"plugins":[
"transform-runtime"
],
"presets":[
"react"
]
},
"failFast": true,

@@ -29,2 +37,3 @@ "files": [

"babel-plugin-add-module-exports": "0.2.1",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-polyfill": "6.9.1",

@@ -35,2 +44,3 @@ "babel-preset-es2015-loose": "^7.0.0",

"babel-register": "6.11.6",
"babel-runtime": "^6.11.6",
"eslint": "3.1.1",

@@ -75,3 +85,3 @@ "eslint-friendly-formatter": "2.0.6",

},
"version": "1.0.0"
"version": "1.1.0"
}

@@ -43,7 +43,12 @@ # hash-it

* `Math`
* It's not a constructor (really just a parent for methods), so there are no values to hash
* `Promise`
* There is no way to obtain the values contained within due to its asynchronous nature
* `WeakMap`
* The spec explicitly forbids iteration over them, so the unique values cannot be discovered
* `WeakSet`
* Same as `WeakMap`
In each of these cases, no matter what the values of the object, they will always yield the same hash result, which is unique to each object type. If you have any ideas about how these can be uniquely hashed, I welcome them!
In the case of `Math`, it's not a constructor (really just a parent for methods), so there are no values to hash. In the case of both `WeakMap` and `WeakSet`, the spec explicitly forbids iteration over them, so the unique values cannot be discovered. In each of these three cases, no matter what the contents of the object, they will always yield the same hash result, which is unique to each object type.
Here is the list of object classes that have been tested and shown to produce unique hashCodes:

@@ -53,2 +58,3 @@ * `Array`

* `Boolean`
* `DataView`
* `Date` (based on `valueOf`)

@@ -59,2 +65,3 @@ * `Error` (based on `message`)

* `Function` (based on `name` and `arguments`)
* `GeneratorFunction` (based on `name` and `arguments`)
* `Int8Array`

@@ -68,2 +75,3 @@ * `Int16Array`

* `Object` (can handle recursive objects)
* `Proxy`
* `RegExp`

@@ -70,0 +78,0 @@ * `Set`

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc