@nataliama/lotide
v1.0.1
Published
A mini clone of the [Lodash](https://lodash.com) library
Downloads
3
Readme
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 @nataliama/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: returns the head (first element) of an arrytail
: returns the tail (all elements except the first) of an arraymiddle
: returns middle element(s) of an arraycountLetters
: counts the number of letters in a string (ignores spaces)countOnly
: counts how many of certain elements exist in an array based on requirement passed as argumentfindKey
: returns the first key for which the callback returns a truthy valuefindKeyByValue
: returns the first key inside an object that contains a given value passed as argumentletterPositions
: returns an array of indexes at which a given letter can be found inside a stringmap
: maps over the elements of an array; takes callback as argumenttakeUntil
: extracts elements of an array until callback reaches a truthy valuewithout
: takes in two arrays and returns a new one containing elements from the first array that are not in the second one