Gathering detailed insights and metrics for reiterator
Gathering detailed insights and metrics for reiterator
Gathering detailed insights and metrics for reiterator
Gathering detailed insights and metrics for reiterator
npm install reiterator
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
23 Commits
2 Watching
5 Branches
1 Contributors
Updated on 06 Jan 2023
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
63%
714
Compared to previous day
Last week
-38.3%
929
Compared to previous week
Last month
1,916%
2,520
Compared to previous month
Last year
985%
3,320
Compared to previous year
1
ReIterator is a node.js module which helps you avoid errors while accessing json from the big bad internet (and your own apis)
I created this package to simplify iterating across arrays and objects without hitting into errors. The Iterator is chainable, making it possible to access items as $$(obj)._('first')._(0)._('second).value()
1yarn add reiterator
1const i = require("reiterator");
2
3// This is our object
4const json = {
5 name: { firstName: "Jack", lastName: "Reaper" },
6 city: "Jakarta",
7 runs: [
8 { run1: { date: "26 March 2020", distance: "5km" } },
9 { run2: { date: "20 March 2020", distance: "5km" } },
10 ],
11 active: true,
12 waiting: null,
13 countries: undefined,
14};
15
16// And this is how you can parse through it
17
18i.$$(json)._("name")._("firstName").string(); // "Jack"
19i.$$(json)._("runs")._(0)._("run1")._("distance").string(); // "5km"
20i.$$(json)._("runs").keys(); // ["run1", "run2"]
21i.$$(json)._("name").value(); // { firstName: "Jack", lastName: "Reaper" }
22
23i.$$(json)._("name"); // { obj: { firstName: "Jack", lastName: "Reaper" } }
24
25i._keys(json.runs); // ["run1", "run2"]
26i._len(json.runs); // 2
27
28i.isUndefined(json.countries); // true
$
and _
are aliases
$$(json)
and new Iterator(json)
are aliases
.keys()
always returns an array
or []
.string()
always returns an string
or ""
1const json = { one: "two" };
2
3const Iterator = require("reiterator");
4
5const i = new Iterator(json);
6const ii = Iterator.$$(json); // alias
7
8i.$("one"); // { obj: "two" }
9i.$("one", true); // "two"
10
11i._("one"); // { obj: "two" } alias
12i._("one", true); // "two" alias
13
14i.keys(); // ["one"]
15Iterator.keys(json); // ["one"]
16
17i.$("one").string(); // "two"
18Iterator._str(json.one); // "two" alias
19
20i.value(); // { "one": "two" }
21
22i.length(); // 1
23Iterator._len(json); // 1
24
25Iterator.hasKey(json, "one"); // true
26Iterator.hasKey(json, "two"); // false
27
28// Other static functions
29Iterator.isArray(json); // false
30Iterator.isObject(json); // true
31Iterator.isNumber(json); // false
32Iterator.isString(json); // false
33Iterator.isBoolean(json); // false
34Iterator.isNull(json); // false
35Iterator.isUndefined(json); // false
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/21 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More