
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.
phane-tech-array-utils
Advanced tools
A lightweight, dependency-free JavaScript module that provides safe and predictable array utility functions.
These helpers make it easy to add, remove, search, transform, and validate arrays while handling edge cases such as null, undefined, empty arrays, and invalid inputs.
Designed to be minimal, consistent, and well-tested for both Node.js and browser environments.
npm install phane-tech-array-utils
import {
getArrayLength,
addItemToAnArray,
addItemsInFrontToAnArray,
addOrRemoveItemsByIndex,
removeFirstItemOfAnArray,
removeLastItemOfAnArray,
mapAnArray,
filterAnArray,
findArrayItem,
findIndexArrayItem,
checkIsMatched,
checkIsAllMatched,
sortAnArray,
flatAnArray,
merginMultipleArray,
countItem
} from "phane-tech-array-utils";
Returns the length of an array.
getArrayLength([1,2,3]); // 3
getArrayLength([]); // 0
Adds an item to the end of the array.
addItemToAnArray([1,2], 3); // [1,2,3]
Adds items to the beginning of an array.
addItemsInFrontToAnArray([2,3], 1); // [1,2,3]
Adds or removes items using index.
addOrRemoveItemsByIndex([1,2,3], 1, 1); // [1,3]
Removes the last element of an array.
removeLastItemOfAnArray([1,2,3]); // [1,2]
Removes the first element of an array.
removeFirstItemOfAnArray([1,2,3]); // [2,3]
Safely maps array values.
mapAnArray([1,2,3], n => n * 2); // [2,4,6]
Filters array values.
filterAnArray([1,2,3], 2); // [2]
filterAnArray([{a:1},{a:2}], {a:1}); // [{a:1}]
Finds the first matched item.
findArrayItem([1,2,3], 2); // 2
Returns the index of the matched item.
findIndexArrayItem([1,2,3], v => v === 2); // 1
Checks if any item matches.
checkIsMatched([1,2,3], 2); // true
Checks if all items match.
checkIsAllMatched([2,2,2], 2); // true
Sorts an array or array of objects.
sortAnArray([3,1,2]); // [1,2,3]
sortAnArray([{a:2},{a:1}], "a"); // [{a:1},{a:2}]
Deep flattens nested arrays.
flatAnArray([1,[],[2,[3]]]); // [1,2,3]
Merges multiple arrays into one.
merginMultipleArray([1],[2],[3]); // [1,2,3]
Counts or sums array values.
countItem([1,2,3]); // 6
countItem([{a:1},{a:2}], "a"); // 3
MIT
FAQs
Pure JavaScript array utility functions
We found that phane-tech-array-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.