puleos / object-hash

Generate hashes from javascript objects in node and the browser.
MIT License
1.4k stars 146 forks source link

Reduce bundle size #117

Open ArtiomTr opened 2 years ago

ArtiomTr commented 2 years ago

Reduced bundle size by removing code duplication. Generates the same hashes as the previous version. Changes:

  1. Separated functions by produced value patterns.
    1. literals - write just <name> to the output stream.
    2. stringifiableObjects - write <name>:<value.toString()> to the output stream.
    3. typedArray - write <name>: to the output stream and stringify as a normal array.
    4. setTypes - write set/map to the output stream by old rules.
  2. Created applyHashes function, which applies hasher function for all given types.