Skip to content

Commit 4f99b5e

Browse files
authoredMar 17, 2022
Replace deprecated String.prototype.substr() (#623)
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>
1 parent e6e5412 commit 4f99b5e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎src/stringify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import validate from './validate.js';
77
const byteToHex = [];
88

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

1313
export function unsafeStringify(arr, offset = 0) {

‎src/version.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function version(uuid) {
55
throw TypeError('Invalid UUID');
66
}
77

8-
return parseInt(uuid.substr(14, 1), 16);
8+
return parseInt(uuid.slice(14, 15), 16);
99
}
1010

1111
export default version;

0 commit comments

Comments
 (0)
Please sign in to comment.