INNER CODE UNIT · TypeScript

clearTypesCache

OS-Guild/graphql-to-mongodb · src/common.ts:10

export function clearTypesCache() {
    Object.keys(typesCache).forEach(_ => delete typesCache[_]);
}

export function cache<T>(cacheObj: object, key: any, callback: cacheCallback<T>): T {
    let item: T = cacheObj[key];

    if (item === undefined) {
        item = callback(key);
        cacheObj[key] = item;
    }

    return item;
}

export function setSuffix(text: string, locate: string, replaceWith: string): string {
    const regex = new RegExp(`${locate}$`);
    return regex.test(text)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…