Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.


node-object-hash example

node v6.17.1
version: 1.0.2
Simple usage example of node-object-hash library
const hasher = require('node-object-hash')({sort:true, coerce:true}); const assert = require('assert'); const a = [true, null, {b:2, a:1, c:3}, 5, 'a', 6, 2]; const b = [{c:3, 'a':true, b:2}, 1, undefined, "6", 5, '2', "a"]; console.log('Sorted string of {a}:', hasher.sortObject(a)); console.log('Sorted string of {b}:', hasher.sortObject(b)); assert.ok(hasher.hash(a) === hasher.hash(b), 'Objects a and b should have equal hashes'); console.log('Hashes are equal');

no comments

    sign in to comment