You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.5 KiB

4 years ago
  1. # hash-sum
  2. > blazing fast unique hash generator
  3. # install
  4. ```shell
  5. npm i hash-sum -S
  6. ```
  7. # features
  8. - no dependencies
  9. - minimal footprint
  10. - works in all of node.js, io.js, and the browser
  11. - hashes functions based on their source code
  12. - produces different hashes for different object types
  13. - support for circular references in objects
  14. - ignores property assignment order
  15. # `sum(value)`
  16. yields a four-byte hexadecimal hash based off of `value`.
  17. ```
  18. # creates unique hashes
  19. creates unique hashes
  20. 4d237d49 from: [ 0, 1, 2, 3 ]
  21. 766ec173 from: { url: 12 }
  22. 2f473108 from: { headers: 12 }
  23. 23308836 from: { headers: 122 }
  24. 062bce44 from: { headers: '122' }
  25. acb9f66e from: { headers: { accept: 'text/plain' } }
  26. 1c365a2d from: { payload: [ 0, 1, 2, 3 ], headers: [ { a: 'b' } ] }
  27. 7319ae9d from: { a: [Function] }
  28. 8a3a0e86 from: { b: [Function] }
  29. b6d7f5d4 from: { b: [Function] }
  30. 6c95fc65 from: function () {}
  31. 2941766e from: function (a) {}
  32. 294f8def from: function (b) {}
  33. 2d9c0cb8 from: function (a) { return a;}
  34. ed5c63fc from: function (a) {return a;}
  35. bba68bf6 from: ''
  36. 2d27667d from: 'null'
  37. 774b96ed from: 'false'
  38. 2d2a1684 from: 'true'
  39. 8daa1a0c from: '0'
  40. 8daa1a0a from: '1'
  41. e38f07cc from: 'void 0'
  42. 6037ea1a from: 'undefined'
  43. 9b7df12e from: null
  44. 3c206f76 from: false
  45. 01e34ba8 from: true
  46. 1a96284a from: 0
  47. 1a96284b from: 1
  48. 29172c1a from: undefined
  49. 4505230f from: {}
  50. 3718c6e8 from: { a: {}, b: {} }
  51. 5d844489 from: []
  52. 938eaaf0 from: Tue Jul 14 2015 15:35:36 GMT-0300 (ART)
  53. dfe5fb2e from: global
  54. ok 1 should be equal
  55. ```
  56. # license
  57. MIT