From c26a6719c6f4657cfd578fa96e16bf034cccce5a Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Sat, 26 Mar 2022 12:53:07 +0100 Subject: [PATCH] refactor: replace deprecated String.prototype.substr() .substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher --- auth-next/apple.js | 2 +- auth/apple.js | 2 +- scripts/separate-snippets.ts | 2 +- snippets/auth-next/apple/auth_apple_nonce_node.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/auth-next/apple.js b/auth-next/apple.js index 29a33dea..4570f883 100644 --- a/auth-next/apple.js +++ b/auth-next/apple.js @@ -169,7 +169,7 @@ function appleNonceNode() { crypto.randomFillSync(buf); nonce = decoder.write(buf); } - return nonce.substr(0, length); + return nonce.slice(0, length); }; const unhashedNonce = generateNonce(10); diff --git a/auth/apple.js b/auth/apple.js index ad65ef08..e99349c8 100644 --- a/auth/apple.js +++ b/auth/apple.js @@ -170,7 +170,7 @@ function appleNonceNode() { crypto.randomFillSync(buf); nonce = decoder.write(buf); } - return nonce.substr(0, length); + return nonce.slice(0, length); }; const unhashedNonce = generateNonce(10); diff --git a/scripts/separate-snippets.ts b/scripts/separate-snippets.ts index ff93a58f..a888d908 100644 --- a/scripts/separate-snippets.ts +++ b/scripts/separate-snippets.ts @@ -77,7 +77,7 @@ function adjustIndentation(lines: string[]) { if (isBlank(line)) { outputLines.push(""); } else { - outputLines.push(line.substr(minIndent)); + outputLines.push(line.slice(minIndent)); } } return outputLines; diff --git a/snippets/auth-next/apple/auth_apple_nonce_node.js b/snippets/auth-next/apple/auth_apple_nonce_node.js index 26bb2ef0..9dd417a5 100644 --- a/snippets/auth-next/apple/auth_apple_nonce_node.js +++ b/snippets/auth-next/apple/auth_apple_nonce_node.js @@ -17,7 +17,7 @@ const generateNonce = (length) => { crypto.randomFillSync(buf); nonce = decoder.write(buf); } - return nonce.substr(0, length); + return nonce.slice(0, length); }; const unhashedNonce = generateNonce(10);