Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xotic750/object-walk-x
Walks a given object and invokes a function on each iteration.
https://github.com/xotic750/object-walk-x
browser ecmascript nodejs walker
Last synced: 15 days ago
JSON representation
Walks a given object and invokes a function on each iteration.
- Host: GitHub
- URL: https://github.com/xotic750/object-walk-x
- Owner: Xotic750
- License: mit
- Created: 2016-01-04T22:40:59.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T22:42:10.000Z (about 2 years ago)
- Last Synced: 2024-12-18T14:12:01.986Z (about 2 months ago)
- Topics: browser, ecmascript, nodejs, walker
- Language: JavaScript
- Homepage:
- Size: 3.04 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## object-walk-x
Walks a given object and invokes a function on each iteration.
- [object-walk-x](#module_object-walk-x)
- [`module.exports(object, props, supplier, [thisArg])`](#exp_module_object-walk-x--module.exports) ⏏
- [`.BREAK`](#module_object-walk-x--module.exports.BREAK) :string
- [`.SKIP`](#module_object-walk-x--module.exports.SKIP) :string
- [`.STOP`](#module_object-walk-x--module.exports.STOP) :string
### `module.exports(object, props, supplier, [thisArg])` ⏏
This method walks a given object and invokes a function on each iteration.
**Kind**: Exported function
| Param | Type | Description |
| --------- | --------------------- | ---------------------------------------------------------------------------------------------------- |
| object |\*
| The `object` to walk. |
| props |function
| The function that returns an array of the properties of `value` to be walked, invoked per iteration. |
| supplier |function
| The function invoked per iteration. |
| [thisArg] |\*
| The `this` binding of `supplier`. |**Example**
```js
const objectWalk from 'object-walk-x';const subject = {
one: {
a: true,
b: true,
},
two: {
x: true,
y: true,
},
};objectWalk(subject, Object.keys, function(value, prop, object, depth) {
object[prop + '_renamed'] = value;
delete object[prop];
});// {
// one_renamed: {
// a_renamed: true,
// b_renamed: true
// },
// two_renamed: {
// x_renamed: true,
// y_renamed: true
// }
// }
```#### `module.exports.BREAK` :
string
**Kind**: static property of [
module.exports
](#exp_module_object-walk-x--module.exports)
**Default**:"break"
#### `module.exports.SKIP` :
string
**Kind**: static property of [
module.exports
](#exp_module_object-walk-x--module.exports)
**Default**:"skip"
#### `module.exports.STOP` :
string
**Kind**: static property of [
module.exports
](#exp_module_object-walk-x--module.exports)
**Default**:"stop"