INNER CODE UNIT · TypeScript

setSuffix

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

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

export interface FieldFilter {
    (name: string, field: { resolve?: Function, dependencies?: string[] }): Boolean
}

export interface TypeResolver<T extends GraphQLType> {
    (graphQLType: GraphQLType): T
}

export interface FieldMap<T extends GraphQLType> {
    [key: string]: Field<T, any, any> & { type: T }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…