Skip to content

Commit 371400b

Browse files
committed
fix: replace with .forEach() due to lack of returns
1 parent 186ff5f commit 371400b

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/generateKeyPair.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default async function generateKeyPair(alg: string, options: Options = op
3939

4040
let optionErrors = isOptionsValid(options);
4141
if (optionErrors.length > 0) {
42-
optionErrors.map(key => {
42+
optionErrors.forEach((key) => {
4343
throw new Error(`${key} is not a valid option for generateKeyPair()`);
4444
});
4545
}

src/generateSecret.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default async function generateSecret(alg: string, options: Options = opt
4646

4747
let optionErrors = isOptionsValid(options);
4848
if (optionErrors.length > 0) {
49-
optionErrors.map(key => {
49+
optionErrors.forEach((key) => {
5050
throw new Error(`${key} is not a valid option for generateSecret()`);
5151
});
5252
}
@@ -67,9 +67,7 @@ export default async function generateSecret(alg: string, options: Options = opt
6767
secret = await generateAESKey(alg, extractable, ['encrypt', 'decrypt']);
6868
}
6969

70-
secret = (options.toKeyObject && secret)
70+
return (options.toKeyObject && secret)
7171
? KeyObject.from(secret)
7272
: secret;
73-
74-
return secret;
7573
}

0 commit comments

Comments
 (0)