Skip to content

Commit 95872bf

Browse files
committed
feat(json-map-keys): initial commit
1 parent 5060278 commit 95872bf

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

packages/json-map-keys/README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# json-map-keys
22

3-
> Replace json values with the key path.
3+
Replace object values with the full keys path.
44

55
Example:
66

77
```json
88
{
9-
"a": {
10-
"b": "Text Note"
9+
"foo": {
10+
"bar": "Bar value",
11+
"baz": {
12+
"qux": 1234
13+
}
1114
}
1215
}
1316
```
@@ -16,16 +19,25 @@ Will generate
1619

1720
```json
1821
{
19-
"a": {
20-
"b": "a.b"
22+
"foo": {
23+
"bar": "foo.bar",
24+
"baz": {
25+
"qux": "foo.baz.qux"
26+
}
2127
}
2228
}
2329
```
2430

31+
## Install
32+
33+
```sh
34+
npm install json-map-keys --save
35+
```
36+
2537
## Usage
2638

2739
```js
28-
import mapKeys from 'json-map-keys'
40+
import { jsonMapKeys } from 'json-map-keys'
2941

3042
const data = { a: { b: 'Text Note' } }
3143
// Result { a: { b: 'a.b' } }

0 commit comments

Comments
 (0)