automatically execute recursion, with the data selection inline
This commit is contained in:
parent
6f0da62ad5
commit
259d1c1aab
1 changed files with 7 additions and 7 deletions
|
@ -19,16 +19,16 @@ nested.dictionary = class dictionary {
|
||||||
|
|
||||||
// Pull the data out.
|
// Pull the data out.
|
||||||
if (DATA != null && DATA != undefined && PATH[`all`].length) {
|
if (DATA != null && DATA != undefined && PATH[`all`].length) {
|
||||||
PATH[`remain`] = PATH[`all`];
|
PATH[`remain`] = [...PATH[`all`]];
|
||||||
PATH[`selected`] = String(PATH[`remain`].shift()).trim();
|
PATH[`selected`] = String(PATH[`remain`].shift()).trim();
|
||||||
|
|
||||||
// Get the selected data.
|
// Get the selected data.
|
||||||
DATA = DATA[PATH[`selected`]];
|
if (Object.hasOwn(DATA, PATH[`selected`])) {
|
||||||
|
DATA = (PATH[`remain`].length)
|
||||||
// must run if there is actually a parameter to test
|
? nested.dictionary.get(DATA[PATH[`selected`]], PATH[`remain`])
|
||||||
if (PATH[`remain`].length > 0) {
|
: DATA[PATH[`selected`]];
|
||||||
// Recursively run to make use of the existing data.
|
} else if (!Object.hasOwn(DATA, PATH[`selected`])) {
|
||||||
DATA = nested.dictionary.get(DATA, PATH[`remain`]);
|
DATA = null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue