Skip to content

Commit

Permalink
fix: replace deprecated String.prototype.substr()
Browse files Browse the repository at this point in the history
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
  • Loading branch information
CommanderRoot committed Apr 5, 2022
1 parent f81ceaf commit bf77b3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var MurmurHash3 = require('imurmurhash')
module.exports = function (uniq) {
if (uniq) {
var hash = new MurmurHash3(uniq)
return ('00000000' + hash.result().toString(16)).substr(-8)
return ('00000000' + hash.result().toString(16)).slice(-8)
} else {
return (Math.random().toString(16) + '0000000').substr(2, 8)
return (Math.random().toString(16) + '0000000').slice(2, 10)
}
}

0 comments on commit bf77b3d

Please sign in to comment.