1.0.4 • Published 2 years ago
@markjust1/lotide v1.0.4
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 @markjust1/lotide
Require it:
const _ = require('@markjust1/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head()
: returns first element in the arraytail()
: returns all the elements in the array except the first onemiddle()
: returns middle element in the array (one element if array length is odd, two - if length is even)map()
: returns first letter of each element in the arraywithout()
: checks two arrays and returns any difference in elementstakeUntil()
: loops through the array and returns the value up to the stop parameterletterPositions()
: returns the object with number of occurences of each letter in a given stringflatten()
: removes any sub-arrays in the array and returns valuefindKeyByValue)
: checks the values in the object by given value and returns corresponding keyfindKey()
: checks the values in the object by given key and returns corresponding valueeqObjects()
: checks if two objects are equaleqArrays()
: checks if two arrays are equalcountOnly()
: counts the number of item occurences in an arraycountLetters()
: counts how many times each letter appers in a array