@zanake/arr v0.0.57
@zanake/arr
A JavaScript utility that provides useful functions to handle various tasks / procedures in an array.
arr . noun
:short for array(a data structure consisting of a collection of elements i.e numbers, strings, objects etc)
Install
Install the package from the NPM registry using the command below:
npm install @zanake/arr
Modules
*- represents anything theanytype
array- represents an array
array<*>- represents an array of any type of objects
| Name | Desc | Signature |
|---|---|---|
arr | Checks if the input is an array | * = 𝑓 (any) |
lottery | Picks a random element in an array | * = 𝑓 (array<*>) |
shuffle | Randomly re-arranges a given array | array<*> = 𝑓 (array<*>) |
Examples
arr()
import { arr } from '@zanake/arr';
console.log(arr([]])) // []
console.log(arr(null)) // []
console.log(arr(undefined)) // []
console.log(arr([1, 2,3 ])) // [1,2,3]lottery()
import { lottery } from '@zanake/arr';
const randomNumber = lottery([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);shuffle()
import { shuffle } from '@zanake/arr';
const reArrangedNumbers = shuffle([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);Powered By Nx
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago