1.0.1 • Published 3 years ago
@jnasato/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 @jnasato/lotide
Require it:
const _ = require('@jnasato/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(...)
: returns a count of each letter in a given stringscountOnly
: returns a specific subset of items from a collectionfindKey(...)
: returns first key for which a callback returns a truthy valuefindKeyByValue(...)
: returns the first key in an object with a given valueflatten(...)
: flattens nested arrays into one combined arrayhead(...)
: retrieves first element in arrayletterPositions(...)
: returns all the index positions of letters in a stringmap(...)
: returns a new array based on the results of a callback functionmiddle(...)
: returns the middle-most element(s) of an arraytail(...)
: retrieves every element of an array excluding the headtakeUntil(...)
: keeps collecting items from a given array until a callback returns a truthy valuewithout(...)
: returns subset of given array, removing unwanted elements