1.0.1 • Published 4 years ago
@cspraggett/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 @cspraggett/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(sentence)
: counts the letters in a sentencecountOnly(allItems, itemsToCount)
: counts the frequency items in allItems occoursfindKeyByValue(obj, value)
: returns the key in the object when passed it's valuefindKey(data, callback)
: returns the first key that callback function returns true toflatten(arrs)
: creates a 1d array from nested arrayshead(arr)
: returns the 0th element from arrletterPositions(sentence)
: returns an object with the index position of each lettermap(array, callback)
: returns an array that transforms each element by the callbackmiddle(arr)
: returns an array with the middle position(s) of arrtail(arr)
: returns an arr starting from index 1takeUntil(arr, callback)
: returns arr until callback returns truewithout(arr, toRemove)
: removes toRemove from arr