0.0.2 • Published 6 years ago

array-utility v0.0.2

Weekly downloads
3
License
MIT
Repository
-
Last release
6 years ago

ArrayUtil v0.0.1

Adds some utility functions to Arrays

Installation

Using NPM:

npm i -g npm
npm i array-utility

Using Yarn:

npm i yarn -g
yarn add array-utility

Examples

Chunk up an Array

require('array-utility'); // Require Array-Utility
const array = ['This', 'is', 'an', 'awesome', 'array']; // The array to chunk

console.log(array.chunk(2)); // => [ [ 'This', 'is' ], [ 'an', 'awesome' ], [ 'array' ] ]

Find closest match in an Array

require('array-utility'); // Require Array-Utility
const array = ['This', 'is', 'an', 'awesome', 'array']; // The array to check

console.log(array.close('thiss', 3)); // => This

Listing an Array

require('array-utility'); // Require Array-Utility
const array = ['This', 'is', 'an', 'awesome', 'array']; // The array to list

console.log(array.list()); // => This, is, an, awesome and array

Trimming an Array

require('array-utility'); // Require Array-Utility
const array = ['This', 'is', 'an', 'awesome', 'array']; // The array to trim

console.log(array.trim(2)); // => [ 'This', 'is', '3 more...' ]

If you need any support, feel free to join https://discord.gg/SV7DAE9 You can support the creator at https://patreon.com/wessel