/
flat-module.ts
61 lines (58 loc) · 1.28 KB
/
flat-module.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { flatten, unflatten } from 'flat'
import { DELIMITER } from './constants'
import { selectParams } from './select-params'
import { filterOutParams } from './filter-out-params'
import { set } from './set'
import { get } from './get'
import { pathToParts } from './path-to-parts'
/**
*
* @memberof module:flat
*/
export type FlatModuleType = {
flatten: typeof flatten;
unflatten: typeof unflatten;
set: typeof set;
get: typeof get;
selectParams: typeof selectParams;
filterOutParams: typeof filterOutParams;
DELIMITER: typeof DELIMITER;
pathToParts: typeof pathToParts;
}
/**
* All the data in records are stored in flatten version.
*
* Helpers gathered in this module will help you manage them
*
* ### Usage
*
* ```javascript
* // on the frontend (i.e in components)
* import { flat } from 'admin-bro'
*
* // on the backend (i.e. in action hooks)
* const { flat } = require('admin-bro')
*
* flat.set(...)
* ```
*
* @module flat
* @name flat
* @new In version 3.3
*/
export const flat: FlatModuleType = {
/**
* Raw `flatten` function exported from original `flat` package.
*/
flatten,
/**
* Raw `unflatten` function exported from original `flat` package.
*/
unflatten,
set,
get,
selectParams,
filterOutParams,
DELIMITER,
pathToParts,
}