d3-dag
Version:
Layout algorithms for visualizing directed acylic graphs.
22 lines (21 loc) • 1.02 kB
TypeScript
/** utility type for replacing keys with new value */
export type U<O, K extends keyof O, V> = Omit<O, K> & Record<K, V>;
/** a callback for things with children */
export interface ChildrenCallback<T> {
(node: T): Iterable<T>;
}
/** depth first search for arbitrary types */
export declare function dfs<T>(children: ChildrenCallback<T>, ...queue: T[]): IterableIterator<T>;
/** pretty error creation */
export declare function err(strings: readonly string[], ...objs: unknown[]): Error;
/** generic internal error */
export declare function ierr(strings: readonly string[], ...info: (string | number | bigint | boolean)[]): Error;
/** something with a name, e.g. a function */
export interface Named {
/** the function name */
name: string;
/** an optional tag we use to identify builtin methods */
d3dagBuiltin?: true;
}
/** customized error when we detect call back was internal */
export declare function berr(strings: readonly string[], named: Named, ...info: (string | number | bigint)[]): Error;