crypto: simplify KeyObject constructor · nodejs/node@178a740 · GitHub
Skip to content

Commit 178a740

Browse files
Trottrichardlau
authored andcommitted
crypto: simplify KeyObject constructor
Inline a function that only gets called in the constructor. Make call to `super()` more straightforward in the process by removing conditional involving the function as it only ever returns `undefined` or else throws. That made the code a little hard to understand, as without looking at the function, one would likely expect it to return `true` on success rather than `undefined`. PR-URL: #35064 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent a12d92c commit 178a740

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

lib/internal/crypto/keys.js

Lines changed: 6 additions & 8 deletions

0 commit comments

Comments
 (0)