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 @yonin/lotide
Require it:
const _ = require('@yonin/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
head,
: returns the first value of an array.tail,
: returns the last value of an array.middle,
: returns the middle value of an array (2 values if the array length is even).assertArraysEqual,
: checks if 2 arrays are equal and logs reportassertEqual,
: checks if 2 values are equalassertObjectsEqual,
: checks if two objects are equalcountLetters,
: returns the amount of letters in a stringcountOnly,
: returns the count of each element in an arrayeqArrays,
: checks if 2 arrays are equal and returns true or falseeqObjects,
: checks if 2 objects are equalfindKey,
: looks for a specified key in a objectfindKeyByValue,
: returns the key of a specified valueletterPositions,
: returns the index of a letter in a arraymap,
: creates a new array adding in logs for each elementtakeUntil,
: takes each element in a array until a specified element and adds the taken elements into a new arraywithout,
: takes each element array in a array except for a specified element and pushes the taken elements