UNPKG

@intlayer/chokidar

Version:

Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.

30 lines 1.31 kB
//#region src/utils/reduceObjectFormat.d.ts type Primitive = string | number | boolean | null | undefined; type Recursive = Primitive | { [key: string]: Recursive; } | Array<Recursive>; /** * Reduce an object to only the shape provided by a format object. * Values are always taken from the source object; the format is used only for structure. * * Examples: * reduceObjectFormat({ a: 1, b: 2 }, { a: 0 }) => { a: 1 } * reduceObjectFormat({ a: { x: 1, y: 2 } }, { a: { x: 0 } }) => { a: { x: 1 } } */ declare const reduceObjectFormat: (source: Recursive, format: Recursive) => Recursive; /** * Returns the subset of source whose keys are NOT present in the format object. * Inverse of reduceObjectFormat. * * Null values in source are always included as explicit fallback markers * (they signal "use default locale" at render time). * * Examples: * excludeObjectFormat({ a: 1, b: 2 }, { b: 0 }) => { a: 1 } * excludeObjectFormat({ a: { x: 1, y: 2 } }, { a: { x: 0 } }) => { a: { y: 2 } } * excludeObjectFormat({ a: null, b: 2 }, { b: 0 }) => { a: null } */ declare const excludeObjectFormat: (source: Recursive, format: Recursive) => Recursive | undefined; //#endregion export { Primitive, Recursive, excludeObjectFormat, reduceObjectFormat }; //# sourceMappingURL=reduceObjectFormat.d.ts.map