1.0.1 • Published 2 years ago
@danispin/lotide v1.0.1
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 Dani Spinosa as part of my learnings at Lighthouse Labs.
Usage
Install it:
npm install @danispin/lotide
Require it:
const _ = require('@danispin/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: returns the first item in an arraytail(...)
: returns all but the first item in an arraymiddle(...)
: returns the middle of an arrayeqArrays(...)
: determines if two arrays are equalassertArraysEqual(...)
: asserts whether or not arrays are equalassertEqual(...)
: asserts if two strings or numbers or booleans are equaleqObjects(...)
: determines if two objects are equalcountLetters(...)
: creates an object that contains the number of times each letter appears in a stringflatten(...)
: takes an array of nested arrays and returns a single-level arraycountOnly(...)
: creates an object from an array that counts how many times each item appears in the arrayletterPositions(...)
: returns the indexes of each appearance of a given letter in a stringfindKeyByValue(...)
: returns a key from an object when given the key's valuefindKey(...)
: returns a key from an object when given various criteriamap(...)
: alters an array according to a supplied functiontakeUntil(...)
: returns part of an array until it meets a supplied functionwithout(...)
: returns a supplied array, with a supplied item removed