Socket
Socket
Sign inDemoInstall

each-props

Package Overview
Dependencies
7
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.2 to 2.0.0

5

index.js
'use strict';
var isPlainObject = require('is-plain-object');
var isPlainObject = require('is-plain-object').isPlainObject;
var defaults = require('object.defaults/immutable');
module.exports = function(obj, fn, opts) {
module.exports = function (obj, fn, opts) {
if (!isObject(obj)) {

@@ -57,2 +57,1 @@ return;

}

45

package.json
{
"name": "each-props",
"version": "1.3.2",
"version": "2.0.0",
"description": "Processes each properties of an object deeply.",
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
"main": "index.js",

@@ -11,13 +12,12 @@ "files": [

"lint": "eslint .",
"test": "mocha",
"coverage": "nyc --reporter=lcov --reporter=text-summary npm test",
"coveralls": "nyc --reporter=text-lcov npm test | coveralls",
"pretest": "npm run lint",
"test": "nyc mocha",
"web:build": "browserify index.js --standalone eachProps -o web/each-props.js && cd web && uglifyjs each-props.js --compress --mangle -o each-props.min.js --source-map url=each-props.min.js.map",
"chrome:install": "npm i --no-save mocha-chrome",
"chrome:test": "mocha-chrome test/web/browser-test.html",
"build": "npm run lint && npm run coverage && npm run web:build && node test/web/make.js"
"build": "npm run lint && npm run test && npm run web:build && node test/web/make.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/sttk/each-props.git"
"url": "git+https://github.com/gulpjs/each-props.git"
},

@@ -32,21 +32,32 @@ "keywords": [

],
"author": "Takayuki Sato",
"license": "MIT",
"engines": {
"node": ">= 10.13.0"
},
"bugs": {
"url": "https://github.com/sttk/each-props/issues"
"url": "https://github.com/gulpjs/each-props/issues"
},
"homepage": "https://github.com/sttk/each-props#readme",
"homepage": "https://github.com/gulpjs/each-props#readme",
"nyc": {
"reporter": [
"lcov",
"text-summary"
]
},
"prettier": {
"singleQuote": true
},
"dependencies": {
"is-plain-object": "^2.0.1",
"is-plain-object": "^5.0.0",
"object.defaults": "^1.1.0"
},
"devDependencies": {
"browserify": "^16.2.2",
"chai": "^3.5.0",
"coveralls": "^3.0.1",
"eslint": "^4.19.1",
"mocha": "^3.2.0",
"nyc": "^11.7.2",
"uglify-js": "^3.3.24"
"browserify": "^17.0.0",
"chai": "^4.3.4",
"eslint": "^7.32.0",
"eslint-config-gulp": "^5.0.1",
"mocha": "^8.4.0",
"nyc": "^15.1.0",
"uglify-js": "^3.14.2"
}
}

@@ -1,3 +0,11 @@

# [each-props][repo-url] [![NPM][npm-img]][npm-url] [![MIT License][mit-img]][mit-url] [![Build Status][travis-img]][travis-url] [![Build Status][appveyor-img]][appveyor-url] [![Coverage Status][coverage-img]][coverage-url]
<p align="center">
<a href="http://gulpjs.com">
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
</a>
</p>
# each-props
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]
Processes each properties of an object deeply.

@@ -34,3 +42,3 @@

eachProps(obj, function(value, keyChain, nodeInfo) {
eachProps(obj, function (value, keyChain, nodeInfo) {
if (keyChain === 'a') {

@@ -55,58 +63,58 @@ nodeInfo.parent['a'] = value * 2;

Executes the *fn* function for all properties.
Executes the _fn_ function for all properties.
#### Parameters:
| Parameter | Type | Description |
|:------------|:------:|:-----------------------------------------------|
| *obj* | object | A plain object to be treated. |
| *fn* |function| A function to operate each properties. |
| *opts* | object | An object to pass any data to each properties. |
| Parameter | Type | Description |
| :-------- | :------: | :--------------------------------------------- |
| _obj_ | object | A plain object to be treated. |
| _fn_ | function | A function to operate each properties. |
| _opts_ | object | An object to pass any data to each properties. |
* **API of *fn* function**
- **API of _fn_ function**
#### <u>fn(value, keyChain, nodeInfo) : boolean</u>
#### <u>fn(value, keyChain, nodeInfo) : boolean</u>
This function is applied to all properties in an object.
This function is applied to all properties in an object.
##### Parameters:
##### Parameters:
| Parameter | Type | Description |
|:------------|:------:|:-----------------------------------------------|
| *value* | any | A property value. |
| *keyChain* | string | A string concatenating the hierarchical keys with dots. |
| *nodeInfo* | object | An object which contains node informations (See [below](#nodeinfo)). |
| Parameter | Type | Description |
| :--------- | :----: | :------------------------------------------------------------------- |
| _value_ | any | A property value. |
| _keyChain_ | string | A string concatenating the hierarchical keys with dots. |
| _nodeInfo_ | object | An object which contains node informations (See [below](#nodeinfo)). |
##### Returns:
##### Returns:
True, if stops digging child properties.
True, if stops digging child properties.
**Type:** boolean
**Type:** boolean
<a name="nodeinfo"></a>
* **Properties of <i>nodeInfo</i>**
- **Properties of <i>nodeInfo</i>**
| Properties | Type | Description |
|:-------------|:------:|:-----------------------------------------|
| *name* | string | The property name of this node. |
| *index* | number | The index of the property among the sibling properties. |
| *count* | number | The count of the sibling properties. |
| *depth* | number | The depth of the property. |
| *parent* | object | The parent node of the property. |
| *sort* |function| A sort function which orders the child properties. This function is inherited from *opts*, if be specified. |
| Properties | Type | Description |
| :--------- | :------: | :---------------------------------------------------------------------------------------------------------- |
| _name_ | string | The property name of this node. |
| _index_ | number | The index of the property among the sibling properties. |
| _count_ | number | The count of the sibling properties. |
| _depth_ | number | The depth of the property. |
| _parent_ | object | The parent node of the property. |
| _sort_ | function | A sort function which orders the child properties. This function is inherited from _opts_, if be specified. |
... and any properties inherited from *opts*.
... and any properties inherited from _opts_.
* **Properties of <i>opts</i>**
- **Properties of <i>opts</i>**
| Properties | Type | Description |
|:-------------|:------:|:-----------------------------------------|
| *sort* |function| A sort function which orders the same level properties. (Optional) |
| Properties | Type | Description |
| :--------- | :------: | :----------------------------------------------------------------- |
| _sort_ | function | A sort function which orders the same level properties. (Optional) |
... and any properties you want to pass to each node.
... and any properties you want to pass to each node.
## License
Copyright (C) 2016-2018 Takayuki Sato
Copyright (C) 2016-2021 Gulp Team.

@@ -116,13 +124,16 @@ This program is free software under [MIT][mit-url] License.

[repo-url]: https://github.com/sttk/each-props/
[npm-img]: https://img.shields.io/badge/npm-v1.3.2-blue.svg
[npm-url]: https://www.npmjs.org/package/each-props/
[mit-img]: https://img.shields.io/badge/license-MIT-green.svg
[mit-url]: https://opensource.org/licenses.MIT
[travis-img]: https://travis-ci.org/sttk/each-props.svg?branch=master
[travis-url]: https://travis-ci.org/sttk/each-props
[appveyor-img]: https://ci.appveyor.com/api/projects/status/github/sttk/each-props?branch=master&svg=true
[appveyor-url]: https://ci.appveyor.com/project/sttk/each-props
[coverage-img]: https://coveralls.io/repos/github/sttk/each-props/badge.svg?branch=master
[coverage-url]: https://coveralls.io/github/sttk/each-props?branch=master
<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/each-props.svg?style=flat-square
[npm-url]: https://www.npmjs.org/package/each-props
[npm-image]: https://img.shields.io/npm/v/each-props.svg?style=flat-square
[ci-url]: https://github.com/gulpjs/each-props/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/each-props/dev?style=flat-square
[coveralls-url]: https://coveralls.io/r/gulpjs/each-props
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/each-props/master.svg
<!-- prettier-ignore-end -->
<!-- prettier-ignore-start -->
[mit-url]: https://opensource.org/licenses/MIT
<!-- prettier-ignore-end -->

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc