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 @juliebede/lotide
Require it:
const _ = require('@juliebede/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
head(array)
: returns the first element of the arraytail(array)
: returns the tail end of an arraymiddle(array)
: returns the middle element(s) of an arraycountLetters(aString)
: returns the number of times each letter is mentioned in the stringcountOnly(arrayOfItems, itemsToCount)
: returns amount of times each item in itemsToCount occurs in arrayOfItemsfindKeyByValue(anObject, value)
: returns the key with the value passed in the object anObjectfindKey(object, callback)
: returns the key given the condition of callback (a function)flatten(array)
: returns the 'flattened' version of a nested arrayletterPositions(sentence)
: returns the index position(s) of each letter that occurs in the sentence (not including space)map(array, callback)
: returns the array where each item in array has been manipulated based on the conditions of callback (a function)takeUntil(array, callback)
: returns the array up to the condition of callback has been metwithout(array, itemsToRemove)
: returns the array, but removed the items that occurs in itemsToRemove