MCPcopy Create free account
hub / github.com/denoland/std / assertValidDigestLength

Function assertValidDigestLength

crypto/crypto.ts:302–312  ·  view source on GitHub ↗

* Asserts that a number is a valid length for a digest, which must be an * integer that fits in a Rust `Vec `, or be undefined.

(value?: number)

Source from the content-addressed store, hash-verified

300 * integer that fits in a Rust `Vec<u8>`, or be undefined.
301 */
302function assertValidDigestLength(value?: number) {
303 if (
304 value !== undefined &&
305 (value < 0 || value > MAX_DIGEST_LENGTH ||
306 !Number.isInteger(value))
307 ) {
308 throw new RangeError(
309 `length must be an integer between 0 and ${MAX_DIGEST_LENGTH}, inclusive`,
310 );
311 }
312}
313
314/** Extended digest algorithm objects. */
315export type DigestAlgorithmObject = {

Callers 2

digestFunction · 0.85
digestSyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected