Skip to main content

Module utils

Module utils 

Source

Structs§

RecursionGuard
A reusable guard that tracks recursion depth and detects cycles.

Constants§

MAX_FIELD_LENGTH
Default maximum length for individual string field values (10 MB).
MAX_ITERATION_COUNT
Default maximum iteration count for loops processing items (100,000).
MAX_MANIFEST_SIZE
Default maximum file size for non-archive manifest files (100 MB).
MAX_RECURSION_DEPTH
Default maximum recursion depth for recursive parsing functions (50 levels).

Functions§

npm_purl
Creates a correctly-formatted npm Package URL for scoped or regular packages.
parse_sri
Parses Subresource Integrity (SRI) format and returns hash as hex string.
read_file_to_string
Reads a file’s entire contents into a String with ADR 0004 security checks.
split_name_email
Parses “Name email@domain.com” format into separate components.
truncate_field
Truncates a string field value to MAX_FIELD_LENGTH bytes if it exceeds the limit, returning the truncated string. Returns the original string if within limits.