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 @shuchita/lotide
Require it:
const _ = require('@shuchita/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: asserts that two arrays are the samehead
: return the first element of an arraytail
: returns everything but the first element of an arraymiddle
: returns the middle element(s) of an arrayassertEqual
: asserts that two primitive values are equalassertObjectsEqual
: asserts that two objects are the samecountLetters
: counts the occurences of the letters in a given stringcountOnly
: counts only the specified items of an arrayeqArray
: checks if two arrays are the sameeqObjects
: checks if two objects are the samefindKey
: finds the first key in an object that satisfies a callback functionfindKeyByValue
: given a value, finds the corresponding key in an objectflatten
: flattens nested arraysletterPositions
: returns which indexes each letter in a string appears atmap
: creates a new array by calling an input function on every element of an input arraytakeUntil
: returns the elements of an array starting from the beginning, until an element returns a truthy value for an elementwithout
: returns an array after removing the elements specified