MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / getKeysStartingWith

Function getKeysStartingWith

lib/properties.ts:159–172  ·  view source on GitHub ↗
(base: string, prefix: string)

Source from the content-addressed store, hash-verified

157}
158
159export function getKeysStartingWith(base: string, prefix: string): string[] {
160 const keys = new Set<string>();
161 for (const elem of hierarchy) {
162 const propertyMap = findProps(base, elem);
163 if (propertyMap) {
164 for (const key of Object.keys(propertyMap)) {
165 if (key.startsWith(prefix)) {
166 keys.add(key);
167 }
168 }
169 }
170 }
171 return [...keys];
172}
173
174export function propsFor(base: string): PropertyGetter {
175 return (property: string, defaultValue: any) => get(base, property, defaultValue);

Callers 1

getKeysStartingWithMethod · 0.85

Calls 2

findPropsFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected