-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.html
64 lines (64 loc) · 1.59 KB
/
index.html
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
62
63
64
<!DOCTYPE html>
<html>
<head>
<title>deepdash demo</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js"></script>
<script src="./browser/deepdash.standalone.js"></script>
<script type="text/javascript">
// deepdash(_);
let obj = {
a: {
b: {
c: {
d: [
{ i: 0 },
{ i: 1 },
{ i: 2 },
{ i: 3 },
{ i: 4 },
{ i: 5 },
{
o: {
d: new Date(),
f: function() {},
skip: {
please: {
dont: {
go: {
here: 'skip it',
},
},
},
},
},
},
],
s: 'hello',
},
b: true,
},
n: 12345,
u: undefined,
},
nl: null,
};
deepdash.eachDeep(obj, (value, key, parentValue, ctx) => {
console.log(
_.repeat(' ', ctx.depth) +
key +
':' +
(value === null ? 'null' : typeof value),
ctx.parent && ' @' + ctx.parent.path
);
if(key=="skip"){
return false;//return false explicitly to skip iteration over current value's children
}
});
// Chaining works too
// _(obj).eachDeep((value, key, path, depth, parent, parentKey, parentPath) => {/* do */}).value();
</script>
</head>
<body>
<h3>See console plz</h3>
</body>
</html>