cyclical-object-hash
Advanced tools
Comparing version 0.0.5 to 0.1.0
14
index.js
@@ -1,2 +0,2 @@ | ||
const stringify = require('fast-json-stable-stringify') | ||
const stringify = require('safe-stable-stringify') | ||
const blake2b = require('blake2b') | ||
@@ -10,14 +10,4 @@ | ||
var output = new Uint8Array(64) | ||
var string | ||
var string = stringify(object) | ||
try { | ||
string = stringify(object) | ||
} catch (error) { | ||
if (error.message.indexOf('circular') >= 0) { | ||
string = stringify(object, {cycles: true}) | ||
} else { | ||
throw error | ||
} | ||
} | ||
return blake2b(output.length).update(Buffer.from(string)) | ||
@@ -24,0 +14,0 @@ } |
{ | ||
"name": "cyclical-object-hash", | ||
"version": "0.0.5", | ||
"version": "0.1.0", | ||
"description": "Deterministically hash a cyclical object with blake2b", | ||
@@ -23,3 +23,3 @@ "main": "index.js", | ||
"blake2b": "2.1.3", | ||
"fast-json-stable-stringify": "2.0.0" | ||
"safe-stable-stringify": "^1.1.0" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
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
6576
84
+ Addedsafe-stable-stringify@^1.1.0
+ Addedsafe-stable-stringify@1.1.1(transitive)
- Removedfast-json-stable-stringify@2.0.0
- Removedfast-json-stable-stringify@2.0.0(transitive)