1.1.1 • Published 4 years ago
@min994/lotide v1.1.1
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 @min994/lotide
Require it:
const _ = require('@min994/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: Return first element of an arraytail(array)
: Return all but the first elements of an arraymiddle(array)
: Return element(s) that are indexed in the middle of an arraymap(array)
: Perform specific action on each element in an arrayletterPositions(array)
: Return letter position of each unique letterflatten(array)
: Flatten multiple array into onefindKeyByValue(object, value)
: Find key by given valuefindKey(object, callback)
: Scan the object and return the first key for which the callback returns a truthy value. If no key is found, then it should return undefined.eqObjects(object1, object2)
: Returns true if both objects have identical keys with identical valueseqArrays(array1, array2)
: Returns true if both arrays have identical valuescountOnly(array, object)
: Count only when given object's value is truecountLetters(sentence)
: Count letters and return count in an objectassertObjectsEqual(object1, object2)
: Returns true if both objects have identical keys with identical valuesassertEqual(actual, expected)
: Verify if result is the same as expectedassertArraysEqual(array1, array2)
: Returns true if both arrays have identical valuestakeUntil(array, callback)
: The function will return a slice of the array with elements taken from the beginning. It should keep going until the callback/predicate returns a truthy valuewithout(array1, array2)
: Return elements in array1 that are not included in array2