Skip to content

Commit

Permalink
Replace deprecated String.prototype.substr() (#623)
Browse files Browse the repository at this point in the history
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) 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 Mar 17, 2022
1 parent e6e5412 commit 4f99b5e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/stringify.js
Expand Up @@ -7,7 +7,7 @@ import validate from './validate.js';
const byteToHex = [];

for (let i = 0; i < 256; ++i) {
byteToHex.push((i + 0x100).toString(16).substr(1));
byteToHex.push((i + 0x100).toString(16).slice(1));
}

export function unsafeStringify(arr, offset = 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/version.js
Expand Up @@ -5,7 +5,7 @@ function version(uuid) {
throw TypeError('Invalid UUID');
}

return parseInt(uuid.substr(14, 1), 16);
return parseInt(uuid.slice(14, 15), 16);
}

export default version;

0 comments on commit 4f99b5e

Please sign in to comment.