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 3.0.0 to 3.0.1

50

index.js

@@ -1,16 +0,34 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const arrayTreeFilter = (data, filterFn, { childrenKeyName = "children" } = {}) => {
const result = [];
let children = data;
for (let level = 0; children.length > 0; level++) {
const foundItem = children.find(item => filterFn(item, level));
if (!foundItem) {
break;
}
result.push(foundItem);
children = foundItem[childrenKeyName] || [];
}
return result;
};
exports.default = arrayTreeFilter;
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
})((function () { 'use strict';
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
})((function () {
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
})((function () {
Object.defineProperty(exports, "__esModule", { value: true });
const arrayTreeFilter = (data, filterFn, { childrenKeyName = "children" } = {}) => {
const result = [];
let children = data;
for (let level = 0; children.length > 0; level++) {
const foundItem = children.find(item => filterFn(item, level));
if (!foundItem) {
break;
}
result.push(foundItem);
children = foundItem[childrenKeyName] || [];
}
return result;
};
exports.default = arrayTreeFilter;
}));
}));
}));
{
"name": "array-tree-filter",
"version": "3.0.0",
"version": "3.0.1",
"description": "filter in array tree",

@@ -8,5 +8,6 @@ "main": "index.js",

"scripts": {
"test": "vitest --coverage",
"prepublishOnly": "npm run tsc",
"tsc": "tsc"
"test": "npm run tsc && npm run build && vitest --coverage",
"prepublishOnly": "npm run build",
"tsc": "tsc --noEmit",
"build": "rollup index.js --output.format umd --name 'arrayTreeFilter' --output.file index.js"
},

@@ -33,2 +34,3 @@ "files": [

"@vitest/coverage-v8": "^2.1.3",
"rollup": "^4.24.0",
"typescript": "^5.6.3",

@@ -35,0 +37,0 @@ "vitest": "^2.1.3"

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