import 'array-flat-polyfill'; import { default as clone_ } from 'clone'; import stableStringify from 'fast-json-stable-stringify'; import { LogicalOperand } from './logical'; export declare const deepEqual: (a: any, b: any) => boolean; export declare const duplicate: typeof clone_; /** * Creates an object composed of the picked object properties. * * var object = {'a': 1, 'b': '2', 'c': 3}; * pick(object, ['a', 'c']); * // → {'a': 1, 'c': 3} * */ export declare function pick(obj: T, props: K[]): Pick; /** * The opposite of _.pick; this method creates an object composed of the own * and inherited enumerable string keyed properties of object that are not omitted. */ export declare function omit(obj: T, props: K[]): Omit; /** * Converts any object to a string representation that can be consumed by humans. */ export declare const stringify: typeof stableStringify; /** * Converts any object to a string of limited size, or a number. */ export declare function hash(a: any): string | number; export declare function isNullOrFalse(x: any): x is false | null; export declare function contains(array: T[], item: T): boolean; /** Returns the array without the elements in item */ export declare function without(array: T[], excludedItems: T[]): T[]; export declare function union(array: T[], other: T[]): T[]; /** * Returns true if any item returns true. */ export declare function some(arr: T[], f: (d: T, k?: any, i?: any) => boolean): boolean; /** * Returns true if all items return true. */ export declare function every(arr: T[], f: (d: T, k?: any, i?: any) => boolean): boolean; export declare function fill(val: T, len: number): T[]; /** * Like TS Partial but applies recursively to all properties. */ export declare type DeepPartial = { [P in keyof T]?: DeepPartial; }; /** * recursively merges src into dest */ export declare function mergeDeep(dest: T, ...src: DeepPartial[]): T; export declare function unique(values: T[], f: (item: T) => string | number): T[]; export interface Dict { [key: string]: T; } /** * Returns true if the two dictionaries disagree. Applies only to defined values. */ export declare function isEqual(dict: Dict, other: Dict): boolean; export declare function setEqual(a: Set, b: Set): boolean; export declare function hasIntersection(a: Set, b: Set): boolean; export declare function prefixGenerator(a: Set): Set; /** * Returns true if a and b have an intersection. Also return true if a or b are undefined * since this means we don't know what fields a node produces or depends on. */ export declare function fieldIntersection(a: Set, b: Set): boolean; export declare function isNumeric(num: string | number): boolean; export declare function differArray(array: T[], other: T[]): boolean; export declare const keys: (o: T) => Extract[]; export declare function vals(x: { [key: string]: T; }): T[]; export declare function entries(x: { [key: string]: T; }): { key: string; value: T; }[]; export declare type Flag = { [K in S]: 1; }; export declare function isBoolean(b: any): b is boolean; /** * Convert a string into a valid variable name */ export declare function varName(s: string): string; export declare function logicalExpr(op: LogicalOperand, cb: (...args: any[]) => string): string; /** * Delete nested property of an object, and delete the ancestors of the property if they become empty. */ export declare function deleteNestedProperty(obj: any, orderedProps: string[]): boolean; export declare function titlecase(s: string): string; /** * Converts a path to an access path with datum. * @param path The field name. * @param datum The string to use for `datum`. */ export declare function accessPathWithDatum(path: string, datum?: string): string; /** * Return access with datum to the flattened field. * * @param path The field name. * @param datum The string to use for `datum`. */ export declare function flatAccessWithDatum(path: string, datum?: 'datum' | 'parent' | 'datum.datum'): string; /** * Replaces path accesses with access to non-nested field. * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`. */ export declare function replacePathInField(path: string): string; /** * Remove path accesses with access from field. * For example, `foo["bar"].baz` becomes `foo.bar.baz`. */ export declare function removePathFromField(path: string): string; /** * Count the depth of the path. Returns 1 for fields that are not nested. */ export declare function accessPathDepth(path: string): number; /** * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included. */ export declare function getFirstDefined(...args: T[]): T; /** * Returns a new random id every time it gets called. * * Has side effect! */ export declare function uniqueId(prefix?: string): string | number; /** * Resets the id counter used in uniqueId. This can be useful for testing. */ export declare function resetIdCounter(): void; export declare function internalField(name: string): string; export declare function isInternalField(name: string): boolean; /** * Normalize angle to be within [0,360). */ export declare function normalizeAngle(angle: number): number; //# sourceMappingURL=util.d.ts.map