
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
array-filter2
Advanced tools
filter array on base of the condition same as filter method work in javascript
npm install array-filter2
The array-filter2 package provides a simple and effective way to filter array in your JavaScript/TypeScript projects. This package allows you to filter array on condition basis various formats with ease.
To install the npm install array-filter2 package, use the following npm command:
npm install array-filter2
Importing the Package
import { useFilterArray } from 'array-filter2';
Uses
#Filtering an array of numbers
const numbers = [1, 2, 3, 4, 5, 6];
const isEven = num => num % 2 === 0;
useFilterArray(numbers, isEven) ; Output: [2, 4, 6]
#Filtering an array of strings
const strings = ['apple', 'banana', 'cherry', 'date'];
const containsA = str => str.includes('a');
useFilterArray(strings, containsA); // Output: ['apple', 'banana', 'date']
#Filtering an array of objects
const people = [
{ name: 'John', age: 25 },
{ name: 'Jane', age: 30 },
{ name: 'Jim', age: 35 },
];
const isOver30 = person => person.age > 30;
useFilterArray(people, isOver30); // Output: [{ name: 'Jim', age: 35 }]
# Filtering an array of mixed types
const mixedArray = [1, 'apple', { name: 'John' }, 2, 'banana', { age: 30 }];
const isString = item => typeof item === 'string';
useFilterArray(mixedArray, isString); // Output: ['apple', 'banana']
FAQs
filter array on base of the condition same as filter method work in javascript
The npm package array-filter2 receives a total of 2 weekly downloads. As such, array-filter2 popularity was classified as not popular.
We found that array-filter2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.