A mini clone of the Lodash library.
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.
Install it:
npm install @andrewlpmcneill/lotide
Require it:
const _ = require('@andrewlpmcneill/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
countLetters
: Takes a string of letters and returns the number of times each occurs, as an objectcount only
: Takes a set of values and an object and returns the number of times each value occurs in the object, as an objecteqArrays
: Determines if two arrays are identicaleqObjects
: Determines if two objects are identicalfindKey
: Takes an object and a callback function and returns the associated keyfindKeyByValue
: Takes an object and a value and returns the associated keyflatten
: Removes nesting from an array to create a single flat arrayhead
: Takes an array and returns the first elementletterPositions
: Takes a string and returns an object of character index valuesmap
: Takes an array and a callback function and applies the callback to the arraymiddle
: Takes an array and returns the middle element(s) of an arraytail
: Takes an array and returns the array after the first elementtakeUntil
: Takes an array and a callback function and returns the array until a match is found, exclusivelywithout
: Takes an array and a list of values to exclude, and returns a new array without the excluded values