MCPcopy Create free account
hub / github.com/arktypeio/arktype / allowedKeysOf

Function allowedKeysOf

ark/sets/structure/structure.ts:97–107  ·  view source on GitHub ↗
(node: Structure.Node)

Source from the content-addressed store, hash-verified

95
96// a sequence declares its indices, and "reject" checks only string keys
97export const allowedKeysOf = (node: Structure.Node): BaseRoot => {
98 let keys = allowedKeys.get(node)
99 if (!keys) {
100 keys = node.keyof()
101 if (node.sequence)
102 keys = keys.rawOr($ark.kw.nonNegativeIntegerString.internal)
103 if (node.undeclared === "reject") keys = keys.rawOr($ark.kw.symbol.internal)
104 allowedKeys.set(node, keys)
105 }
106 return keys
107}
108
109// how many leading indices are checked one by one for a bound
110const maxCountedIndices = 1024

Callers 1

narrowToKeysOfFunction · 0.85

Calls 3

getMethod · 0.65
keyofMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected