1.0.1 • Published 4 years ago
@ericasun2000/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 me as part of my learnings at Lighthouse Labs.
Usage
Install it:
npm install @ericasun2000/lotide
Require it:
const _ = require('@ericasun2000/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: gets the first element of the arraytail(array)
: gets all but the first element of the arraywithout(array1, array2)
: returns array1 without the elements in array2flatten(array)
: returns the array without nested arraysmiddle(array)
: gets the middle element of the arraycountOnly(array1, array2)
: counts the number of occurences of each element in array2 in array1countLetters(string)
: counts the number of occurences of each character in the stringletterPositions(string)
: returns the indices in the string where each character is foundfindKeyByValue(object, value)
: finds the key associated to the valuemap(array, callback)
: returns new array by executing the callback on each element in the arraytakeUntil(array, callback)
: returns the slice of the array before the callback returns a truthy valuefindKey(object, callback)
: returns the key of the first property for which the callback return a truthy value