@hazae41/arrays
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

Arrays

Utilities to deal with arrays

npm i @hazae41/arrays

Node Package 📦

Features

Current features

  • 100% TypeScript and ESM
  • No external dependency
  • Unit-tested and benchmarked
  • Get the last value
  • Get a random value using Math's PRNG
  • Get a random value using WebCrypto's CSPRNG
  • Sized types ArrayLike<T,N> and Array<T,N>

Usage

Arrays.last

Get the last value

import { Arrays } from "@hazae41/arrays"

const value = Arrays.getLastOrNull([1, 2, 3, 4, 5])

Arrays.random

Get a random value using Math's PRNG

import { Arrays } from "@hazae41/arrays"

const value = Arrays.getRandomOrNull([1, 2, 3, 4, 5])

Arrays.cryptoRandom

Get a random value using WebCrypto's CSPRNG

import { Arrays } from "@hazae41/arrays"

const value = Arrays.getCryptoRandomOrNull([1, 2, 3, 4, 5])

Package Sidebar

Install

npm i @hazae41/arrays

Weekly Downloads

5

Version

2.0.3

License

MIT

Unpacked Size

20.8 kB

Total Files

13

Last publish

Collaborators

  • hazae41