A mini clone of the Lodash library.
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.
Install it:
npm install @emihi/lotide
Require it:
const _ = require('@emihi/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
assertArraysEqual
: console.logs string stating whether input arrays are equalassertEqual
: console.logs string stating whether primitive inputs are equalassertObjectsEqual
: console.logs string stating whether input objectss are equalcountLetters
: given an array, returns object of letter countscountOnly
: given an array and an object with keys and true or false, will return counts of items that are in array that are trueeqArrays
: given two arrays, will return true if they are equal, returns false if noteqObjects
: given two objects, will return true if they are equal, returns false if notfindKey
: given an object and callback, will find value of keyfindKeyByValue
: given an object and value, will return keyflatten
: returns a single array, with any internal arrays merged into the main onehead
: returns the first item in arrayletterPositions
: returns the positiona at which characters occur in a given stringmap
: takes array and callback, returns new array that is a modified version of the original (modified based on function)middle
: returns middle of array (1 item if length is odd, average of 2 if length is even)tail
: returns all items in array except the firsttakeUntil
: returns all items in an array until a condition is met (ie one of the items equals a specified string)without
: given a array and a value, returns an array without the specified value