@abhiram-satha/lotide
v1.0.2
Published
lighthouselabs
Downloads
13
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 Lighthouse Labs.
Usage
Install it:
npm install @abhiram-satha/lotide
Require it:
const _ = require('@abhiram-satha/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: returns the first element of an arraytail(array)
: returns all the elements after the first elementmiddle(array)
: returns the elements located in the middle of an arrayeqArrays(array1, array2)
: returns true is the elements of 2 arrays are equal and returns false if oppositeassertEqual(actual, expected)
: compares 2 elements and returns true if they are equal and false if they are notassertArraysEqual(array1, array2)
: returns true is the elements of 2 arrays are equal and returns false if oppositeflatten(array)
: Flattens out array of arrays into a single arraycountOnly(allItems, itemsToCount)
: counts only the true items listed in the second argumentfindKeyByValue(object, value)
: Returns the key for the provided value within an objecttakeUntil(array, callback)
: Splices an array until until the criteria set by callback function is metcountLetters(sentence)
: Provides an object with the characters and the amount of times the characters appeared in the sentencewithout(source, itemsToRemove)
: Takes two arrays as an argument, and returns the unique items from the first array argumenteqObjects(object1, object2)
: compares two objects, and returns true if the key-values match, and false is they do notfindKey(object, callback)
: Returns the first key based on the callback function matches the value in an objectletterPositions(sentence)
: provides an object of arrays, listing the index of the characters based in the function argumentmap(array, callback)
: produces a new array based on the parameters set in the callback function, based as a second parameter