-
Notifications
You must be signed in to change notification settings - Fork 8
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: New package JSON hash added #186
base: development
Are you sure you want to change the base?
Conversation
…lter-support Mongoose filter query - added support for more complex filters
Fix(mongoose-audit): exception when change is null
Add #111 Switch to lefthook for git hooks
Fix #111 Address PR comments
Fix #111 Change lefthook linting command name
Add #111 Switch to lefthook for git hooks
Fix: Docs for default export require statements updated
Add #104 Type support for actions-exec-wrapper added
…rsing Fix(filter-query): added automatic parsing of object ids
Fix(mongoose-filter-query): incorrect parsing of regexp
…ean-parse Fix(mongoose-filter-query): default boolean parsing
…iers Feat(filter-query): added support for regexp modifiers
Feat(service-connector): added support for retrying
…rsing Fix(filter-query): in & nin object id parse
packages/json-hash/src/algorthms.js
Outdated
}; | ||
|
||
export const isAvailableAlgo = (algorithm) => { | ||
if (Object.prototype.hasOwnProperty.call(algos, algorithm)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use algos[algorithm] here instead right, will be more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const objectToHash = { name: "Siri", age: 30, country: "Sri Lanka" }; | ||
|
||
beforeAll(() => { | ||
global.unit_tests_running = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we won't need this, this flag was used to handle a few edge cases of tests in a couple of other packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This package is intended to be used for hashing a provided JS object in both Node.js and browser(eg-: for Next.js). Users will be provided an option to sort the JS object since order of properties is not guaranteed by JSON.stringify. This sorting will be done using this package which will be imported dynamically. I've kept sorting optional, in case of a string being passed as a parameter to the algorithm.
On the browser side hashing will be done using the inbuilt SubteCrypto Web API which only provides the following algorithms for creating a hash.
In node.js we use the inbuilt crypto module, Even though node.js crpto module provides more algorithms than the ones available in the browser to maintain cross platform compatibility (browser and node.js), I've limited the available algorithms only the ones available in browser.