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.
Install it:
npm install @sohaib-go/lotide
Require it:
const _ = require('@sohaib-go/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
head(array)
: returns the first element of an arraytail(array)
: returns the tail of an arraymiddle(array)
: returns the middle element of an arrayassertEqual(actual, expected)
: asserts if two values are equalassertArraysEqual(actual, expected)
: asserts if two arrays are equalassertObjectsEqual(actual, expected)
: asserts if two objects are equalcountLetters(string)
: returns an object with the count of each letter in a stringcountOnly(allItems, itemsToCount)
: returns an object with the count of each item in an arrayeqArrays(array1, array2)
: returns true if two arrays are equaleqObjects(object1, object2)
: returns true if two objects are equalfindKey(object, callback)
: returns the first key for which the callback returns a truthy valuefindKeyByValue(object, value)
: returns the first key which contains the given valueflatten(array)
: returns a flattened version of a nested arrayletterPositions(string)
: returns an object with the index of each letter in a stringmap(array, callback)
: returns a new array based on the results of the callback functiontakeUntil(array, callback)
: returns a slice of the array with elements taken from the beginningwithout(source, itemsToRemove)
: returns a subset of a given array, removing unwanted elementsAuthor: Sohaib-GO
Source Code: https://github.com/Sohaib-GO/lotide
License: ISC