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 @alanmak95/lotide
Require it:
const _ = require('@alanmak95/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: returns the first element in an arraytail(...)
: returns the last element in an arraymiddle(...)
: returns the middle element in an arrayassertArraysEqual(...)
: compares two arrays to see if they are equal or notassertEqual(...)
: compares two items to see if they are equal or notassertObjectsEqual(...)
: compares two objects to see if they are equal or notcountLetters(...)
: counts the different letters in a stringcountOnly(...)
: takes a collection of items and return count for a specific subset of those itemseqArrays(...)
: takes in two arrays and returns true or false based on a perfect matcheqObjects(...)
: return true or false based on a perfect matchfindKey(...)
: scan an object and returns the first key for which the callback returns a truthy valuefindKeyByValue(...)
: search a key on an object where its value matches a given valueflatten(...)
: lowers the elements of an array by one levelletterPositions(...)
: return all the indices in the string where each character is foundmap(...)
: return a new array based on the results of a callback functiontakeUntil(...)
: return a "slice of the array with elements taken from the beginning" until callback provides a truthy valuewithout(...)
: return an array removing unwated elements