import Opt = require("../Opt"); export declare var defined: (x: any) => boolean; export interface Dict { [key: string]: T; } export interface Constructor { new (...args: any[]): T; } /** * Arrays of Objects are common in RAML08. * @param x * @returns {{}} */ export declare function flattenArrayOfObjects(x: { [key: string]: T; }[]): { [key: string]: T; }; export declare function find(xs: T[], f: (T: any) => boolean): Opt; export declare var isInstance: (v: any, C: Constructor) => T[]; export declare var ifInstanceOf: (v: any, C: Constructor, f: (T: any) => void) => void; export declare function toTuples(map: { [key: string]: U; }): Array<[string, U]>; export declare function fromTuples(tuples: Array<[string, U]>): { [key: string]: U; }; export declare var collectInstancesOf: (xs: any[], C: Constructor) => T[]; export declare var collectInstancesOfInMap: (map: any, C: Constructor) => [string, T][]; export declare var asArray: (v?: T | T[]) => T[]; export declare var shallowCopy: (obj: Dict) => Dict; export declare var flatMap: (xs: T[], f: (T: any) => U[]) => U[]; export declare var flatten: (xss: T[][]) => T[]; export declare var takeWhile: (xs: T[], f: (T: any) => boolean) => T[]; export declare function tap(v: T, f: (T: any) => void): T; export declare function kv(obj: Dict, iter: { (string: any, T: any): void; }): void; export declare function indexed(objects: Array>, key: string, delKey?: boolean): Dict>; export declare function stringEndsWith(str: string, search: string): boolean; export declare function stringStartsWith(str: string, search: string, ind?: number): boolean; export declare function lazypropkeyfilter(k: string): boolean; export declare function lazyprops(obj: Object, keyfilter?: typeof lazypropkeyfilter): void; export declare function iff(v: T, f: { (T: any): void; }): void; export declare function isRAMLUrl(str: string): boolean; export declare function getAllRequiredExternalModulesFromCode(code: string): string[]; export declare var serial: () => number; export declare function isEssential(arg: any): boolean; export declare function firstToUpper(q: string): string; export declare function updateObject(source: any, target: any, addNewFields?: boolean): void; /** * In 'str' replace all occurences of 'map' keys to their values. */ export declare function replaceMap(str: string, map: { [key: string]: string; }): string; /** * Replace all occurences of 'x' in 'str' to 'r' without thinking if 'x' can be passed without * escaping as argument to RegExp constructor */ export declare function replace(str: string, x: string, r: string): string; export declare function deepCopy(val: any): any;