object-deep-iteration

1.0.0 • Public • Published

object-deep-iteration

Iterates over a object of elements, yielding each in turn to an iteratee function. Iterates is a deep dive into object.

The iteratee is bound to the context object, if one is passed. Each invocation of iteratee is called with three arguments: (element, path, obj).

Example:
 
let obj = {
    name: "test",
    flags: {
        checked: true
    }
};
 
let output = [];
 
let iteration = function(value, path) {
    output.push({ path: path, value: value });
};
 
objectDeepIteration(obj, iteration);
 
console.log(output);
 
Result:
[
    { path: "name", value: "test" },
    { path: "flags", value: { checked: true } },
    { path: "flags.checked", value: true }
]

Readme

Keywords

none

Package Sidebar

Install

npm i object-deep-iteration

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

2.5 kB

Total Files

4

Last publish

Collaborators

  • nlapshin