Skip to content

PromptScript API


Function: normalizeImportKey()

normalizeImportKey(value): string

Defined in: validator/src/import-exclusions.ts:14

Normalize an import source to its lockfile key form.

Strips transport details so https://github.com/org/repo.git, git@github.com:org/repo, and github.com/org/repo all compare equal. Mirrors the normalization the compiler applies to lockfile dependency keys. Implemented with plain string operations so adversarial import strings cannot trigger regex backtracking (CodeQL js/polynomial-redos, Sonar S8786).

Parameters

value

string

Returns

string