@luc-ky/lotide
v1.0.0
Published
A mini clone of the Lodash https://lodash.com library
Downloads
1
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 @luc-ky/lotide
Require it:
const _ = require('@luc-ky/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: asserts two arrays are equalassertEqual
: console logs if assertion is true or falseassertObjectsEqual
: asserting two objects are equalcountLetters(string)
: returns an object with the count of each of the letters in the stringcountOnly(array, object)
: returns counts for a subset of those itemseqArrays(array, array)
: compares two arrays for a perfect matcheqObjects(object, object)
: returns if two objects are perfect matchfindKey(object, callback)
: returns the first key which the callback returns a truthy valuefindKeyByValue(object, value)
: scans the object and returns the first key which contains the given valueflatten(array)
: returns a flattened arrayhead(array)
: returns the first element of an arrayletterPositions(string)
: takes a sentence and returns the indices where each letter is foundmap(array, callback)
: maps a new array based on the results of the callback functionmiddle(array)
: returns the middle elements of an arraytail(array)
: returns all elements of an array except for the firsttakeUntil(array, callback)
: takes an array and a callback and returns a new arraywithout(array, itemsToRemove)
: returns the subset of a given array while removing unwanted elements