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 @theabo/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(...)
: asserts if two arrays are equalassertEqual(...)
: asserts if two primitive data types are equalassertObjectsEqual(...)
: asserts if two objects are equalcountLetters(...)
: counts the number of letters in a stringcountOnly(...)
: counts the number of occurences of an item in an arrayeqArrays(...)
: tests if two arrays are equaleqObjects(...)
: tests if two objects are equalfindKey(...)
: evaluates an object and callback function, scans object to find the first key that the callback returns truthy valuefindKeyByValue(...)
: evaluates an object and a value, scans object and returns the first key that equals the valuehead(...)
: gives the first item in an arrayindex(...)
: contains all the exported functionsletterPositions(...)
: returns an object that contains all the indices of where each item appears in a stringmap(...)
: returns new array with the results of a callback function changing the items in the arraymiddle(...)
: returns the middle items of an arraytail(...)
: gives the values of an array except the first itemtakeUntil(...)
: return an portion of an array that occurs before a callback function has a truthy valuewithout(...)
: returns an array without unwanted items