Skip to content

Instantly share code, notes, and snippets.

@gsimone
Created February 24, 2022 11:53
Show Gist options
  • Save gsimone/45a0b1ab37e3f29eb6a5af54e093c22d to your computer and use it in GitHub Desktop.
Save gsimone/45a0b1ab37e3f29eb6a5af54e093c22d to your computer and use it in GitHub Desktop.
const hash = require('object-hash')
const sum = require('hash-sum')
const a = hash({ color: "red" })
const b = hash({ color: "blue" })
console.assert(a !== b)
const c = hash({ color: "red", opacity: 1 }, { unorderedObjects: true })
const d = hash({ opacity: 1, color: "red" }, { unorderedObjects: true })
console.log(c, d)
console.assert(c === d)
const e = sum({ color: "red", opacity: 1 })
const f = sum({ opacity: 1, color: "red" })
console.assert(e === f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment