Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-tree-filter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-tree-filter - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

index.d.ts

35

lib/index.js

@@ -8,20 +8,19 @@ (function (global, factory) {

function arrayTreeFilter(data, filterFn, options) {
options = options || {};
options.childrenKeyName = options.childrenKeyName || 'children';
var children = data || [];
var result = [];
var level = 0;
var foundItem;
do {
var foundItem = children.filter(function(item) {
return filterFn(item, level);
})[0];
if (!foundItem) {
break;
}
result.push(foundItem);
children = foundItem[options.childrenKeyName] || [];
level += 1;
} while(children.length > 0);
return result;
options = options || {};
options.childrenKeyName = options.childrenKeyName || "children";
var children = data || [];
var result = [];
var level = 0;
do {
var foundItem = children.filter(function (item) {
return filterFn(item, level);
})[0];
if (!foundItem) {
break;
}
result.push(foundItem);
children = foundItem[options.childrenKeyName] || [];
level += 1;
} while (children.length > 0);
return result;
}

@@ -28,0 +27,0 @@

{
"name": "array-tree-filter",
"version": "2.0.0",
"version": "2.1.0",
"description": "filter in array tree",

@@ -9,7 +9,6 @@ "main": "lib/index.js",

"pub": "npm run build && npm publish",
"build": "rollup index.js --output.format umd --name 'arrayTreeFilter' --output.file lib/index.js"
"tsc": "tsc",
"build": "npm run tsc && rollup index.js --output.format umd --name 'arrayTreeFilter' --output.file lib/index.js"
},
"files": [
"lib"
],
"files": ["lib", "index.d.ts"],
"repository": {

@@ -19,7 +18,3 @@ "type": "git",

},
"keywords": [
"array",
"tree",
"filter"
],
"keywords": ["array", "tree", "filter"],
"author": "afc163 <afc163@gmail.com>",

@@ -33,4 +28,5 @@ "license": "MIT",

"rollup": "^0.52.1",
"tape": "^4.3.0"
"tape": "^4.3.0",
"typescript": "^2.7.1"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc