@aeedwko/lotide
v1.0.2
Published
Mini clone of the Lodash library for learning purposes
Downloads
6
Readme
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 Lighthoand use Labs.
Usage
Install it:
npm install @aeedwko/lotide
Require it:
const _ = require('@aeedwko/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: Asserts if the contents of two arrays are equal or notassertEqual(actual, expected)
: Asserts if two values are equal or notassertObjectsEqual(actual, expected)
: Asserts if the contents of two objects are equal or notcountLetters(sentence)
: Returns an object denoting each unique letter in a sentence and its countcountOnly(allItems, itemsToCount)
: Returns an object denoting the count of each string specified by the user in an arrayeqArrays(arr1, arr2)
: Returns true if the contents of two arrays are equal, otherwise returns falseeqObjects(object1, object2)
: Returns true if both objects have identical keys and values, otherwise returns falsefindKey(obj, callback)
: Returns the object's key based on the callbackfindKeyByValue(obj, val)
: Returns the object's key that matches the passed valueflatten(arr)
: Returns a flattened arrayhead(arr)
: Returns the first element of the arrayletterPositions(sentence)
: Returns an object denoting each unique letter and its position(s) in the sentencemiddle(arr)
: Returns an array with the element(s) in the middle of the arr parametertail(arr)
: Returns an array without the first element of the arr parametertakeUntil(array, callback)
: Returns an array of elements based on the callbackwithout(source, itemsToRemove)
: Returns an array without any elements specified in itemsToRemove