1.0.0 • Published 3 years ago
@butlerlr/lotide v1.0.0
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 @butlerlr/lotide
Require it:
const _ = require('@butlerlr/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: takes the first index of an array and generates a new arraytail(...)
: takes the last index of an array and generates a new arraymiddle(...)
: takes the middle index of an array and generates a new arrayflatten(...)
: generates a new array from a nested arrayassertObjectsEqual(...)
: asserts if objects are equalassertEqual(...)
: asserts if two strings or integers are equalassertArraysEqual(...)
: asserts if arrays are equalcountLetters(...)
: counts itemscountOnly(...)
: counts only a certain itemeqArrays(...)
: check if two arrays are equaleqObjects(...)
: check if two objects are equalfindKey(...)
: find the key of an objectfindKeyByValue(...)
: find the key of an object using its valuemap(...)
: Lotide's map functionletterPositions(...)
: return all the indices in the string where each character is foundtakeUntil(...)
: return a slice of the array with elements taken from the beginning.without(...)
: return a subset of a given array, removing unwanted elements
1.0.0
3 years ago