
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
basic-array
Advanced tools
npm install basic-array
<script src="https://cdn.jsdelivr.net/npm/basic-array@latest/script.js"></script>
const BasicArray = require("basic-array");
const basicArray = new BasicArray();
let array = [1, 2, 3, 4, 5];
/* Return a Random Value From The Array */
console.log(basicArray.randomValue(array)); // ====> 2
/* Return a Random Values From The Array According To The Number of Values */
console.log(basicArray.randomValues(array, 3)); // ====> [4, 2, 5]
const BasicArray = require("basic-array");
const basicArray = new BasicArray();
let array = [1, 2, 3, 4, 5];
/* Return The First Value From The Array */
console.log(basicArray.firstValue(array)); // ====> 1
/* Return The First Values From The Array According To The Number of Values */
console.log(basicArray.firstValues(array, 3)); // ====> [1, 2, 3]
const BasicArray = require("basic-array");
const basicArray = new BasicArray();
let array = [1, 2, 3, 4, 5];
/* Return The Last Value From The Array */
console.log(basicArray.lastValue(array)); // ====> 5
/* Return The Last Values From The Array According To The Number of Values */
console.log(basicArray.lastValues(array, 3)); // ====> [5, 4, 3]
const BasicArray = require("basic-array");
const basicArray = new BasicArray();
let array = [1, 2, 3, 4, 5];
/* Return a New Array With All Values But With Random Index */
console.log(basicArray.arrayRandom(array)); // ====> [2, 4, 5, 1, 3]
/* Return The Length of The Array */
console.log(basicArray.arrayLength(array)); // ====> 5
/* Return a New Array With All Values Plus The Pushed Values */
console.log(basicArray.arrayPush(array, 6)); // ====> [1, 2, 3, 4, 5, 6]
/* Return a New Array With All Values Except The Pulled Values */
console.log(basicArray.arrayPull(array, [5, 4])); // ====> [1, 2, 3]
/* Return True if The Array Contains The Value Else Return False */
console.log(basicArray.arrayHas(array, 3)); // ====> true
/* Return True if The Array Equal The Second Array Else Return False */
console.log(basicArray.arrayEqual(array, [1, 2, 3, 4, 5])); // ====> true
/* Return The Values Of The Array That Not in The Second Array */
console.log(basicArray.arrayDiff(array, [1, 2, 3])); // ====> [4, 5]
FAQs
Modify Your Arrays With Some Basic Functions
We found that basic-array 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
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.