INNER CODE UNIT · TypeScript

getDefaultId

babyfish-ct/graphql-ts-client · api/src/DependencyManager.ts:268

function getDefaultId(value: any): any {
    const id = value.id ?? value._id;
    if (id === undefined) {
        throw Error(`There is no id/_id in the object ${JSON.stringify(value)}`);
    }
    return id;
}

function compute<K, V>(map: Map<K, V>, key: K, valueSupplier: (key: K) => V): V {
    let value = map.get(key);
    if (value === undefined) {
        map.set(key, value = valueSupplier(key));
    }
    return value;
}

type RecursiveResourceMap = Map<string, Resources | RecursiveResourceMap>;
function removeResource(recursiveResourceMap: RecursiveResourceMap, resource: string) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…