-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Operation: Extract Hash Values #512
Conversation
Hey, would you be able to resolve the conflicts and update this to the latest version of master? Would be good to get this merged in :) |
No problem! I'll get that resolved |
I'm loving the number of people who are still around 5 years later. Apologies it took so long to get to this! |
15d48ae
to
a6b774d
Compare
const results = []; | ||
let hashCount = 0; | ||
|
||
const hashLength = args[0]; |
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.
Nitpick: This can be shortened to:
const [hashLength, serachAllHashes, showDisplayTotal] = args
/** | ||
* Extract Hash Values operation | ||
*/ | ||
class ExtractHashes extends Operation { |
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.
Please could you add some unit tests. This would help ensure we are extracting the correct hashes in the future!
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.
No problem! I've added some unit tests.
const regex = new RegExp(`(\\b|^)[a-f0-9]{${hashCharacterLength}}(\\b|$)`, "g"); | ||
const searchResults = search(input, regex, null, false); | ||
|
||
hashCount += searchResults.split("\n").length - 1; |
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.
This area crashed for me when I tested it out. I've made some changes to hopefully resolve the issues I saw. Could you verify it works for you as well?
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.
Thank you! That works for me as well.
Looks great to me, thanks for continuing to contribute when you originally opened your PR over 5 years ago! |
References #466
Adds operation for extracting hash values from text blocks. Searches text for hashes based on length.
Options for:
If it makes more sense to select hash types by name from a dropdown rather than by character length, I can change that.