Skip to content

Commit

Permalink
Merge pull request #18 from medic911/master
Browse files Browse the repository at this point in the history
Fix strToHex function for 0-9 char codes
  • Loading branch information
jecsham authored Jan 18, 2020
2 parents 3636e83 + 2526362 commit 8195315
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/str-to-hex.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module.exports = (str, options) => {
let hex = "";
for (let i = 0, l = str.length; i < l; i++) {
hex += str.charCodeAt(i).toString(16);
hex += str.charCodeAt(i).toString(16).padStart(2, '0');
}
if (options) {
if (options.grouped) {
Expand Down

0 comments on commit 8195315

Please sign in to comment.