puleos / object-hash

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

Add algorithm 'none' for easy debugging. #106

Closed EliteMasterEric closed 3 years ago

EliteMasterEric commented 3 years ago

Currently, when I want to debug to see what the string that would be hashed is, I have to run the following:

let output = '';
require('object-hash').writeToStream(input, options, {
  write: (x) => {
    output += x;
  },
});
return output;

It would be convenient if, when the hashing algorithm requested is none or some other placeholder value, the library would simply output the value that would be hashed.

addaleax commented 3 years ago

PRs are welcome :)

EliteMasterEric commented 3 years ago

Hey, so it appears this feature already existed, named passthrough rather than none.

I didn't realize it existed since it is completely absent from the documentation, and only found it after inspecting the code. I just made pull request #107, which revises the documentation to inform users about the feature.

addaleax commented 3 years ago

Thanks for the PR!