DefinitelyTyped/types/flat/index.d.ts
Oz Weiss affb171262
add missing option transformKey in flat (#42613)
* transformKey + fix tests

* update version
2020-03-02 09:44:26 -08:00

43 lines
921 B
TypeScript

// Type definitions for flat 5.0.0
// Project: https://github.com/hughsk/flat
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// Oz Weiss <https://github.com/thewizarodofoz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var flatten: FlatTypes.Flatten;
export = flatten;
declare namespace FlatTypes {
interface FlattenOptions {
delimiter?: string;
safe?: boolean;
maxDepth?: number;
transformKey?: (key: string) => string;
}
interface Flatten {
<TTarget, TResult>(
target: TTarget,
options?: FlattenOptions
): TResult;
flatten: Flatten;
unflatten: Unflatten;
}
interface UnflattenOptions {
delimiter?: string;
object?: boolean;
overwrite?: boolean;
transformKey?: (key: string) => string;
}
interface Unflatten {
<TTarget, TResult>(
target: TTarget,
options?: UnflattenOptions
): TResult;
}
}