@cgravel/lotide
v1.0.0
Published
array utility library
Readme
Lotide
A mini clone of the Lodash library.
Purpose
BEWARE: This library was published for learning purposes. It is not intended for use in production-grade software.
This project was created and published by me as part of my learnings at Lighthouse Labs.
Usage
Install it:
npm install @cgravel/lotide
Require it:
const _ = require('@cgravel/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head: get the first element of an arraytail: get the last element of an arraymiddle: get the middle element(s) of an arrayassertArraysEqual: check if two arrays are equalassertEqual: check if two values are equalassertObjectsEqual: check if two objects are equalcountLetters: count letters in a stringcountOnly: count items in an arrayeqArrays: check if two arrays have equal lengtheqObjects: check if two objects have equal lengthfindKey: find key inside an objectfindKeyByValue: find key inside an object using its valueletterPositions: find the positions of a letter in a stringmap: map through an arraytakeUntil: using a callback to loop an arraywithout: remove items from an array
