MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / get

Method get

lib/properties.ts:317–338  ·  view source on GitHub ↗
(
        langs: string | LanguageDef[] | Record<string, any>,
        key: string,
        defaultValue?: PropertyValue,
        fn?: (item: PropertyValue, language?: any) => unknown,
    )

Source from the content-addressed store, hash-verified

315 ): Record<LanguageKey, R>;
316
317 get(
318 langs: string | LanguageDef[] | Record<string, any>,
319 key: string,
320 defaultValue?: PropertyValue,
321 fn?: (item: PropertyValue, language?: any) => unknown,
322 ) {
323 const map_fn = fn || _.identity;
324 if (_.isEmpty(langs)) {
325 return map_fn(this.ceProps(key, defaultValue));
326 }
327 if (isString(langs)) {
328 if (this.propsByLangId[langs]) {
329 return map_fn(this.$getInternal(langs, key, defaultValue), this.languages[langs]);
330 }
331 logger.error(`Tried to pass ${langs} as a language ID`);
332 return map_fn(defaultValue);
333 }
334 return _.chain(langs)
335 .map(lang => [lang.id, map_fn(this.$getInternal(lang.id, key, defaultValue), lang)])
336 .object()
337 .value();
338 }
339}
340
341export function setDebug(debug: boolean) {

Callers

nothing calls this directly

Calls 4

$getInternalMethod · 0.95
isStringFunction · 0.85
errorMethod · 0.80
objectMethod · 0.80

Tested by

no test coverage detected