Skip to content

Commit 71c95ee

Browse files
refactor: replace deprecated String.prototype.substr() (#281)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
1 parent 2b97722 commit 71c95ee

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

auth-next/apple.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function appleNonceNode() {
169169
crypto.randomFillSync(buf);
170170
nonce = decoder.write(buf);
171171
}
172-
return nonce.substr(0, length);
172+
return nonce.slice(0, length);
173173
};
174174

175175
const unhashedNonce = generateNonce(10);

auth/apple.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function appleNonceNode() {
170170
crypto.randomFillSync(buf);
171171
nonce = decoder.write(buf);
172172
}
173-
return nonce.substr(0, length);
173+
return nonce.slice(0, length);
174174
};
175175

176176
const unhashedNonce = generateNonce(10);

scripts/separate-snippets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function adjustIndentation(lines: string[]) {
7777
if (isBlank(line)) {
7878
outputLines.push("");
7979
} else {
80-
outputLines.push(line.substr(minIndent));
80+
outputLines.push(line.slice(minIndent));
8181
}
8282
}
8383
return outputLines;

snippets/auth-next/apple/auth_apple_nonce_node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const generateNonce = (length) => {
1717
crypto.randomFillSync(buf);
1818
nonce = decoder.write(buf);
1919
}
20-
return nonce.substr(0, length);
20+
return nonce.slice(0, length);
2121
};
2222

2323
const unhashedNonce = generateNonce(10);

0 commit comments

Comments
 (0)