@creditkarma/dynamic-config
Version:
Dynamic Config for Node.js backed by Consul and Vault
34 lines (33 loc) • 1.43 kB
TypeScript
export declare function readValueFromArgs(key: string, args: Array<string>): string | undefined;
export declare function readFromEnv(key: string): string | undefined;
export declare function readFromEnvOrProcess(key: string): string | undefined;
export declare function readFirstMatch(...keys: Array<string>): string | undefined;
export declare function isPrimitiveType(type: string): type is 'string' | 'number' | 'boolean';
export declare function isPrimitive(obj: any): obj is string | number | boolean;
export declare function isNothing(obj: any): boolean;
export declare function isSomething(obj: any): boolean;
export declare function isObject(obj: any): obj is object;
export interface IArrayKey {
key: string;
index: number;
}
export declare function isNumeric(val: string): boolean;
/**
* This will handle reading a key that contains an array index.
*
* Example:
*
* 'databases[2]' -> { key: 'databases', index: 2 }
*
* TODO:
* This will not handle multi-dimensional arrays
*
* Example:
*
* databases[1][4] -> { key: 'databases[1]', index: 4 }
*/
export declare function parseArrayKey(rawKey: string): IArrayKey | null;
export declare function normalizePath(key: string): string;
export declare function splitKey(key: string): Array<string>;
export declare function dashToCamel(str: string): string;
export declare function memoize<A extends Array<any>, B>(fn: (...args: A) => B): (...args: A) => B;