GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — lib,src: deduplicate code by jasnell · Pull Request #67495 · nodejs/node Conversation
|
|
Review requested:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@ ## main #67495 +/- ## ========================================== + Coverage 90.67% 90.68% +0.01% ========================================== Files 799 800 +1 Lines 280245 280134 -111 Branches 54125 54079 -46 ========================================== - Hits 254100 254037 -63 + Misses 16280 16252 -28 + Partials 9865 9845 -20
🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
SQLite LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
node:crypto and Web Cryptography LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM on behalf of http 👾
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM, http part
Sorry, something went wrong.
There was an error while loading. Please reload this page.
util.debounce() and util.throttle() duplicated the construction of the AbortError used for cancel()/abort, and the property definitions for the returned function's control methods, state getters, length, and name. Move both into internal/util/wrapped_function. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The Writable and Duplex adapters created from web streams duplicated the logic that encodes string chunks as a Uint8Array before writing them to the WritableStream. Move it into a shared encodeStringChunk() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
SQLTagStore::Run(), Iterate(), Get(), and All() each duplicated the database state checks, statement preparation, and parameter binding. Move them into a shared PrepareForExecution() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
URLPattern::Exec() and URLPattern::Test() duplicated the parsing of the input and baseURL arguments. Move it into a shared ParseURLPatternMatchArgs() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
IndexOfString() and IndexOfBuffer() duplicated the computation of the search range and the early returns for empty needles, empty haystacks, and out-of-range offsets. Move it into a shared GetIndexOfSearchRange() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The two Hash::HashInit() overloads duplicated the logic that determines the digest length and validates the requested XOF output length after the digest context is initialized. Move it into a shared FinishHashInit() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The SecureContext ticket key callback signatures repeated the same backend-specific preprocessor block to select between EVP_MAC_CTX and HMAC_CTX. Define the type once as TicketHmacCtx and use it instead. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The RSA, EC, CFRG, ML-DSA, and ML-KEM importKey implementations each duplicated the handling of the 'KeyObjectHandle', 'spki', and 'pkcs8' formats. Move it into a shared importAsymmetricKeyHandle() helper in webcrypto_util, with an optional hook that ML-DSA and ML-KEM use to reject PKCS#8 keys without a seed. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
exportKeySpki() and exportKeyPkcs8() contained identical switch statements mapping the algorithm name to its export function. Move the lookup into a shared getAsymmetricKeyExporter() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
ClientRequest and Server duplicated the validation of the insecureHTTPParser and httpValidation options, including the check that they are mutually exclusive. Move it into a shared setHttpParserOptions() helper in internal/http. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
util.debounce() and util.throttle() duplicated the construction of the AbortError used for cancel()/abort, and the property definitions for the returned function's control methods, state getters, length, and name. Move both into internal/util/wrapped_function. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The Writable and Duplex adapters created from web streams duplicated the logic that encodes string chunks as a Uint8Array before writing them to the WritableStream. Move it into a shared encodeStringChunk() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
SQLTagStore::Run(), Iterate(), Get(), and All() each duplicated the database state checks, statement preparation, and parameter binding. Move them into a shared PrepareForExecution() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
URLPattern::Exec() and URLPattern::Test() duplicated the parsing of the input and baseURL arguments. Move it into a shared ParseURLPatternMatchArgs() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
IndexOfString() and IndexOfBuffer() duplicated the computation of the search range and the early returns for empty needles, empty haystacks, and out-of-range offsets. Move it into a shared GetIndexOfSearchRange() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The two Hash::HashInit() overloads duplicated the logic that determines the digest length and validates the requested XOF output length after the digest context is initialized. Move it into a shared FinishHashInit() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The SecureContext ticket key callback signatures repeated the same backend-specific preprocessor block to select between EVP_MAC_CTX and HMAC_CTX. Define the type once as TicketHmacCtx and use it instead. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: #67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The RSA, EC, CFRG, ML-DSA, and ML-KEM importKey implementations each duplicated the handling of the 'KeyObjectHandle', 'spki', and 'pkcs8' formats. Move it into a shared importAsymmetricKeyHandle() helper in webcrypto_util, with an optional hook that ML-DSA and ML-KEM use to reject PKCS#8 keys without a seed. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
exportKeySpki() and exportKeyPkcs8() contained identical switch statements mapping the algorithm name to its export function. Move the lookup into a shared getAsymmetricKeyExporter() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
ClientRequest and Server duplicated the validation of the insecureHTTPParser and httpValidation options, including the check that they are mutually exclusive. Move it into a shared setHttpParserOptions() helper in internal/http. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
util.debounce() and util.throttle() duplicated the construction of the AbortError used for cancel()/abort, and the property definitions for the returned function's control methods, state getters, length, and name. Move both into internal/util/wrapped_function. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The Writable and Duplex adapters created from web streams duplicated the logic that encodes string chunks as a Uint8Array before writing them to the WritableStream. Move it into a shared encodeStringChunk() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
SQLTagStore::Run(), Iterate(), Get(), and All() each duplicated the database state checks, statement preparation, and parameter binding. Move them into a shared PrepareForExecution() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
URLPattern::Exec() and URLPattern::Test() duplicated the parsing of the input and baseURL arguments. Move it into a shared ParseURLPatternMatchArgs() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
IndexOfString() and IndexOfBuffer() duplicated the computation of the search range and the early returns for empty needles, empty haystacks, and out-of-range offsets. Move it into a shared GetIndexOfSearchRange() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The two Hash::HashInit() overloads duplicated the logic that determines the digest length and validates the requested XOF output length after the digest context is initialized. Move it into a shared FinishHashInit() helper. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The SecureContext ticket key callback signatures repeated the same backend-specific preprocessor block to select between EVP_MAC_CTX and HMAC_CTX. Define the type once as TicketHmacCtx and use it instead. Assisted-by: Claude Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#67495 Reviewed-By: Guilherme Araújo <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.