Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add algorithm 'none' for easy debugging. #106

Closed
EliteMasterEric opened this issue Dec 31, 2020 · 3 comments
Closed

Add algorithm 'none' for easy debugging. #106

EliteMasterEric opened this issue Dec 31, 2020 · 3 comments

Comments

@EliteMasterEric
Copy link
Contributor

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
Copy link
Collaborator

PRs are welcome :)

EliteMasterEric added a commit to EliteMasterEric/object-hash that referenced this issue Jan 1, 2021
This resolves issue puleos#106 .

I was looking for an algorithm option which would display the unhashed value, read the documentation, and assumed there wasn't one, without a more thorough look at the code.

Once I inspected the code to make a pull request, I saw the feature already existed. The simple solution is to describe the feature in the appropriate place in the documentation of `hash()`.
@EliteMasterEric
Copy link
Contributor Author

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 pushed a commit that referenced this issue Jan 1, 2021
This resolves issue #106 .

I was looking for an algorithm option which would display the unhashed value, read the documentation, and assumed there wasn't one, without a more thorough look at the code.

Once I inspected the code to make a pull request, I saw the feature already existed. The simple solution is to describe the feature in the appropriate place in the documentation of `hash()`.
@addaleax
Copy link
Collaborator

addaleax commented Jan 1, 2021

Thanks for the PR!

@addaleax addaleax closed this as completed Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants