1.0.0 • Published 2 years ago
@thedevworkshop/lotide v1.0.0
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 @thedevworkshop/lotide
Require it:
const _ = require('@thedevworkshop/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: returns the first item in an arraytail(...)
: returns all the itmes in an array except the first itemmiddle(...)
: returns the middle-most element(s) of a given arrayfindKey(...)
: returns the first key for which the callback returns a truthy value. If no key is found, then it should return undefinedfindKeyByValue(...)
: returns the first key which contains the given value. If no key with that given value is found, then it should return undefinedflatten(...)
: returns a "flattened" version of a nested arrayletterPosition(...)
: returns all the indices (zero-based positions) in the string where each character is found.map(...)
: returns a new array with each element being the result of the callback functiontakeUntil(...)
: returns a "slice of the array with elements taken from the beginning." It should keep going until the callback/predicate returns a truthy valuewithout(...)
: returns a subset of a given array, removing unwanted elementscountOnly(...)
: return counts for a specific subset of those itemscountLetters(...)
: returns a count of each of the letters in a sentence
1.0.0
2 years ago