1.0.0 • Published 4 years ago
@morsalrnt/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 @morsalrnt/lotide
Require it:
const _ = require('@morsalrnt/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: asserts if two arrays are equalsassertEqual(value1, value2)
: asserts if two values are equalsassertObjectsEqual(object1, object2)
: asserts if two objects are equalshead(array)
: returns the 1st element of an arrayletterPositions(string)
: returns all the indices/position of each character in the stringmap(array, callback)
: returns a new array with the applied callback on the original arraymiddle(array)
: returns the middle element of an arraytail(array)
: returns the entire array minus the first element.takeUntil(array, callback)
: returns an array with elements upto the callback providedwithout(list, filter)
: returns a new array without the filter listeqArrays(array1, array2)
: compares for equality between two arrays. Recursive for arrays within arrays.eqObjects(object1, object2)
: compares for equality between two objects. Recursive for objects within objects.countLetters(string)
: returns the count of each letter within the stringcountOnly(array, object)
: counts and returns occurrence of object within the array.findKey(object, callback)
: scans the object and return the first key for which the callback returns a truthyfindKeyByValue(object, objectValue)
: takes an obeject and returns the key of the object value.
1.0.0
4 years ago