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

object-code

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-code - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

2

dist/index.js

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

function t(t,e){return t>e?1:-1}exports.hash=function e(r,o){var n=5381;if("object"==typeof r&&null!==r&&(r.toString===Object.prototype.toString||r.toString===Array.prototype.toString)){o||(o=new WeakSet);for(var a=Object.keys(r).sort(t),i=0;i<a.length;i++){var c=a[i],f=r[c];if(n=33*n^e(c,o),"object"==typeof f&&null!==f&&!(f instanceof Date||f instanceof RegExp)){if(o.has(f))continue;o.add(f)}n=33*n^e(f,o)}return 33*n^e(r.constructor,o)}for(var s=typeof r+(r instanceof Date?r.getTime():String(r)),p=0;p<s.length;p++)n=33*n^s.charCodeAt(p);return n},exports.sortNumbers=t;
function t(t,r){return t>r?1:-1}exports.hash=function r(o,e){var n=5381;if("object"==typeof o&&null!==o&&(o.toString===Object.prototype.toString||o.toString===Array.prototype.toString)){e||(e=new WeakSet);for(var i=Object.keys(o).sort(t),a=0;a<i.length;a++){var c=i[a],g=o[c];if(n=33*n^r(c,e),"object"==typeof g&&null!==g&&(o.toString===Object.prototype.toString||o.toString===Array.prototype.toString)){if(e.has(g))continue;e.add(g)}n=33*n^r(g,e)}return 33*n^r(o.constructor,e)}var p=typeof o;try{o instanceof Date?p+=o.getTime():p+=String(o)}catch(t){p+=String(Object.assign({},o))}for(var s=0;s<p.length;s++)n=33*n^p.charCodeAt(s);return n},exports.sortNumbers=t;
//# sourceMappingURL=index.js.map

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t||self).objectCode={})}(this,function(t){function e(t,e){return t>e?1:-1}t.hash=function t(o,n){var r=5381;if("object"==typeof o&&null!==o&&(o.toString===Object.prototype.toString||o.toString===Array.prototype.toString)){n||(n=new WeakSet);for(var f=Object.keys(o).sort(e),i=0;i<f.length;i++){var a=f[i],c=o[a];if(r=33*r^t(a,n),"object"==typeof c&&null!==c&&!(c instanceof Date||c instanceof RegExp)){if(n.has(c))continue;n.add(c)}r=33*r^t(c,n)}return 33*r^t(o.constructor,n)}for(var s=typeof o+(o instanceof Date?o.getTime():String(o)),u=0;u<s.length;u++)r=33*r^s.charCodeAt(u);return r},t.sortNumbers=e});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t||self).objectCode={})}(this,function(t){function e(t,e){return t>e?1:-1}t.hash=function t(o,n){var r=5381;if("object"==typeof o&&null!==o&&(o.toString===Object.prototype.toString||o.toString===Array.prototype.toString)){n||(n=new WeakSet);for(var i=Object.keys(o).sort(e),f=0;f<i.length;f++){var c=i[f],a=o[c];if(r=33*r^t(c,n),"object"==typeof a&&null!==a&&(o.toString===Object.prototype.toString||o.toString===Array.prototype.toString)){if(n.has(a))continue;n.add(a)}r=33*r^t(a,n)}return 33*r^t(o.constructor,n)}var p=typeof o;try{o instanceof Date?p+=o.getTime():p+=String(o)}catch(t){p+=String(Object.assign({},o))}for(var s=0;s<p.length;s++)r=33*r^p.charCodeAt(s);return r},t.sortNumbers=e});
//# sourceMappingURL=index.umd.js.map
{
"name": "object-code",
"version": "1.3.1",
"version": "1.3.2",
"description": "A blazing fast hash code generator that supports every possible javascript value.",

@@ -5,0 +5,0 @@ "homepage": "https://tinylibs.js.org/packages/object-code",

@@ -133,18 +133,18 @@ <br />

Object Code:
287 970 ops/s, ±0.33% | 91.35% slower
492 919 ops/s, ±0.90% | 84.72% slower
Object Hash:
52 045 ops/s, ±0.30% | slowest, 98.44% slower
48 311 ops/s, ±0.89% | slowest, 98.5% slower
Object Code (Jsonified Object):
406 813 ops/s, ±0.23% | 87.78% slower
401 901 ops/s, ±0.75% | 87.54% slower
Object Hash (Jsonified Object):
221 757 ops/s, ±0.30% | 93.34% slower
213 819 ops/s, ±0.48% | 93.37% slower
Object Code (String):
3 328 770 ops/s, ±0.21% | fastest
3 225 590 ops/s, ±1.94% | fastest
Object Hash (String):
456 392 ops/s, ±0.43% | 86.29% slower
424 569 ops/s, ±2.88% | 86.84% slower
```

@@ -151,0 +151,0 @@

@@ -56,3 +56,4 @@ import { sortNumbers } from './util';

value !== null &&
!(value instanceof Date || value instanceof RegExp)
(val.toString === Object.prototype.toString ||
val.toString === Array.prototype.toString)
) {

@@ -76,4 +77,14 @@ if (seen.has(value)) {

const toHash = typeof val + (val instanceof Date ? val.getTime() : String(val));
let toHash = typeof val;
try {
if (val instanceof Date) {
toHash += val.getTime();
} else {
toHash += String(val);
}
} catch (error) {
toHash += String(Object.assign({}, val));
}
for (let i = 0; i < toHash.length; i++) {

@@ -80,0 +91,0 @@ h = (h * 33) ^ toHash.charCodeAt(i);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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