{"id":14982060,"url":"https://github.com/gulpjs/each-props","last_synced_at":"2025-10-19T11:31:18.473Z","repository":{"id":46305878,"uuid":"69742276","full_name":"gulpjs/each-props","owner":"gulpjs","description":"Process object properties deeply.","archived":false,"fork":false,"pushed_at":"2023-09-03T23:42:31.000Z","size":118,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T15:14:39.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gulpjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-10-01T14:10:15.000Z","updated_at":"2023-11-05T01:07:13.000Z","dependencies_parsed_at":"2022-09-08T22:01:00.873Z","dependency_job_id":"b3b7bcaa-b2d7-46a2-93da-25b6be61c251","html_url":"https://github.com/gulpjs/each-props","commit_stats":{"total_commits":41,"total_committers":5,"mean_commits":8.2,"dds":0.6097560975609756,"last_synced_commit":"a3675b60576809ad901c0d3b85b35f8ab2bee715"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Feach-props","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Feach-props/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Feach-props/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Feach-props/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gulpjs","download_url":"https://codeload.github.com/gulpjs/each-props/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237116937,"owners_count":19258331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:04:43.175Z","updated_at":"2025-10-19T11:31:13.158Z","avatar_url":"https://github.com/gulpjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://gulpjs.com\"\u003e\n    \u003cimg height=\"257\" width=\"114\" src=\"https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# each-props\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]\n\nProcesses each properties of an object deeply.\n\n## Install\n\nTo install from npm:\n\n```sh\n$ npm i each-props --save\n```\n\n## Usage\n\nApply a function to all (non plain object) properties.\n\n```js\nconst eachProps = require('each-props');\n\nvar obj = { a: 1, b: { c: 'CCC', d: { e: 'EEE' } } };\n\neachProps(obj, function (value, keyChain, nodeInfo) {\n  if (keyChain === 'a') {\n    nodeInfo.parent['a'] = value * 2;\n  } else if (keyChain === 'b.c') {\n    nodeInfo.parent['c'] = value.toLowerCase();\n  } else if (keyChain === 'b.d') {\n    return true; // stop to dig\n  } else if (keyChain === 'b.d.e') {\n    nodeInfo.parent['e'] = value.toLowerCase();\n  }\n});\n\nconsole.log(obj);\n// =\u003e { a: 2, b: { c: 'ccc', d: { e: 'EEE' } } };\n```\n\n## API\n\n### eachProps(obj, fn [, opts]) : void\n\nExecutes the _fn_ function for all properties.\n\n#### Parameters:\n\n| Parameter |   Type   | Description                                    |\n| :-------- | :------: | :--------------------------------------------- |\n| _obj_     |  object  | A plain object to be treated.                  |\n| _fn_      | function | A function to operate each properties.         |\n| _opts_    |  object  | An object to pass any data to each properties. |\n\n- **API of _fn_ function**\n\n  #### fn(value, keyChain, nodeInfo) : boolean\n\n  This function is applied to all properties in an object.\n\n  ##### Parameters:\n\n  | Parameter  |  Type  | Description                                                         |\n  | :--------- | :----: | :------------------------------------------------------------------ |\n  | _value_    |  any   | A property value.                                                   |\n  | _keyChain_ | string | A string concatenating the hierarchical keys with dots.             |\n  | _nodeInfo_ | object | An object which contains node informations (See [below][nodeinfo]). |\n\n  ##### Returns:\n\n  True, if stops digging child properties.\n\n  **Type:** boolean\n\n- ##### **Properties of _nodeInfo_**\n\n  | Properties |   Type   | Description                                                                                                 |\n  | :--------- | :------: | :---------------------------------------------------------------------------------------------------------- |\n  | _name_     |  string  | The property name of this node.                                                                             |\n  | _index_    |  number  | The index of the property among the sibling properties.                                                     |\n  | _count_    |  number  | The count of the sibling properties.                                                                        |\n  | _depth_    |  number  | The depth of the property.                                                                                  |\n  | _parent_   |  object  | The parent node of the property.                                                                            |\n  | _sort_     | function | A sort function which orders the child properties. This function is inherited from _opts_, if be specified. |\n\n  ... and any properties inherited from _opts_.\n\n- ##### **Properties of _opts_**\n\n  | Properties |   Type   | Description                                                        |\n  | :--------- | :------: | :----------------------------------------------------------------- |\n  | _sort_     | function | A sort function which orders the same level properties. (Optional) |\n\n  ... and any properties you want to pass to each node.\n\n## License\n\nMIT\n\n\u003c!-- prettier-ignore-start --\u003e\n[downloads-image]: https://img.shields.io/npm/dm/each-props.svg?style=flat-square\n[npm-url]: https://www.npmjs.org/package/each-props\n[npm-image]: https://img.shields.io/npm/v/each-props.svg?style=flat-square\n\n[ci-url]: https://github.com/gulpjs/each-props/actions?query=workflow:dev\n[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/each-props/dev.yml?branch=master\u0026style=flat-square\n\n[coveralls-url]: https://coveralls.io/r/gulpjs/each-props\n[coveralls-image]: https://img.shields.io/coveralls/gulpjs/each-props/master.svg\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- prettier-ignore-start --\u003e\n[nodeinfo]: #properties-of-nodeinfo\n\u003c!-- prettier-ignore-end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulpjs%2Feach-props","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgulpjs%2Feach-props","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulpjs%2Feach-props/lists"}