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

Function validateKey

http/unstable_structured_fields.ts:1418–1432  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

1416}
1417
1418function validateKey(key: string): void {
1419 if (key.length === 0) {
1420 throw new TypeError("Key cannot be empty");
1421 }
1422
1423 if (!isKeyStart(key[0]!)) {
1424 throw new TypeError("Key must start with lowercase letter or '*'");
1425 }
1426
1427 for (let i = 1; i < key.length; i++) {
1428 if (!isKeyChar(key[i]!)) {
1429 throw new TypeError(`Invalid character in key at position ${i}`);
1430 }
1431 }
1432}

Callers 2

serializeDictionaryFunction · 0.85
serializeParametersFunction · 0.85

Calls 2

isKeyStartFunction · 0.85
isKeyCharFunction · 0.85

Tested by

no test coverage detected