UNPKG
json8-pointer
Version:
latest (1.0.6)
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
0.7.1
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0
0.1.0
JSON Pointer toolkit for JavaScript
github.com/sonnyp/JSON8/tree/main/packages/pointer
sonnyp/JSON8
json8-pointer
/
lib
/
dict.js
14 lines
(11 loc)
•
279 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"use strict"
;
const
walk =
require
(
"./walk"
);
module
.
exports
=
function
index
(
json
) {
const
dict =
Object
.
create
(
null
);
walk
(json,
function
(
value, pointer
) {
if
(
typeof
value !==
"object"
|| value ===
null
) { dict[pointer] = value; } });
return
dict; };