
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.
@jitiendran/funarray
Advanced tools
This is the light weight array package with fun array manipulations and methods.
npm install --save @jitiendran/funarray
Or if you're not into package management, just download a ZIP file.
After installing the package first the require the package from node modules into your javasctript file
const { FunArray } = require("@jitiendran/funarray");
Now, you can create a empty array by creating a object for the class FunArray.
let array = new FunArray();
You can also add element to array array while creating itself by doing the below.
let array = new FunArray(1, 2, 3, 4);
let fruits = new FunArray("Apple", "Bannana", "Orange");
let fruits = new FunArray();
fruits.push("Apple");
fruits.push("Bannana");
let fruit = fruits.atIndex(0); //returns value
const index = fruits.indexOf('Apple') //returns index
let fruit = fruits[index].
for (let i = 0; i < fruits.length(); i++) {
console.log(fruits.atIndex(i));
}
Output
Apple
Bannana
Orange
fruits.pop(); //removes last item
console.log(fruits.array()); //converts funarray to array
Output
[ 'Apple', 'Bannana' ]
fruits.shift(); //removes Apple from front
fruits.unshift("Strawberry");
//output: ['Strawberry','Bannana','Orange']
fruits.unshift('Strawberry','PineApple',...)
fruits.removeAt(0); //removes the elements at index 0
fruits.remove("Apple"); //removes apple
let copy = fruits.slice();
fruits.print(); //prints the array
const str = fruits.toString();
fruits.trash();
fruits.fill("Avacado"); //fills everything with Avacado
fruits.fill("Avacado", 0, 1); //fills Avacado starting from index 0 upto 1
let vegetables = new FunArray("Tomato", "Onion", "Brinjal");
fruits.merge(vegetables);
fruits.print();
Output
[ 'Apple', 'Bannana', 'Orange', 'Vegetables', 'Onion', 'Brinjal' ]
let num = new FunArray(1, 2, 3, 3).distinct(); //returns normal array
console.log(num);
//output [1,2,3]
let users = new FunArray(
{
_id: 1,
Username: "Albert",
},
{ _id: 2, Username: "Jason" }
);
users.removeWhere("_id === 1"); //expression should be string
console.log(users.array());
Output
[ { _id: 2, Username: 'Jason' } ]
let users = new FunArray(
{
_id: 1,
Username: "Albert",
},
{ _id: 2, Username: "Albert" },
{ _id: 3, Username: "Jason" }
);
let foundUsers = users.findWhere("Username === Albert"); //returns normal array
console.log(foundUsers);
Output
[ { _id: 1, Username: 'Albert' }, { _id: 2, Username: 'Albert' } ]
const num = new FunArray(4, 2, 3, 3);
let users = new FunArray(
{
_id: 2,
Username: "Albert",
},
{ _id: 1, Username: "Albert" },
{ _id: 3, Username: "Jason" }
);
num.sortAsc();
users.sortAsc("_id"); //sort by any key;
num.print();
users.print();
Output
[ 2, 3, 3, 4 ]
[
{ _id: 1, Username: 'Albert' },
{ _id: 2, Username: 'Albert' },
{ _id: 3, Username: 'Jason' }
]
const num = new FunArray(4, 2, 3, 3);
let users = new FunArray(
{
_id: 2,
Username: "Albert",
},
{ _id: 1, Username: "Albert" },
{ _id: 3, Username: "Jason" }
);
num.sortDesc();
users.sortDesc("_id"); //sort by any key;
num.print();
users.print();
Output
[ 4, 3, 3, 2 ]
[
{ _id: 3, Username: 'Jason' },
{ _id: 2, Username: 'Albert' },
{ _id: 1, Username: 'Albert' }
]
const names = new FunArray("Albert", "Albert", "Jason");
names.replace("Albert", "Happy"); // By default occurence is 1
console.log(names.array());
names.replace("Albert", "Happy", 2); //specifying occurence
console.log(names.array());
Output
[ 'Happy', 'Albert', 'Jason' ]
[ 'Happy', 'Happy', 'Jason' ]
const names = new FunArray("Albert", "Albert", "Jason");
names.replaceAll("Albert", "Happy");
Output
[ 'Happy', 'Happy', 'Jason' ]
const names = new FunArray("Albert", "Albert", "Jason");
names.funPush("James", "Elric", "Alphonse");
names.print();
Output
[ 'Albert', 'Albert', 'Jason', 'James', 'Elric', 'Alphonse' ]
const names = new FunArray("Albert", "Albert", "Jason");
names.findAndUpdate(0, "Alphonse");
names.print();
Ouput
[ 'Alphonse', 'Albert', 'Jason' ]
FAQs
This is a npm package with fun and easy array operation
We found that @jitiendran/funarray demonstrated a not healthy version release cadence and project activity because the last version was released 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.