1.0.0 • Published 2 years ago
@shreypatel/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 @shrey/lotide
Require it:
const _ = require('@shrey/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 but the first element of an arraymiddle(array)
: returns the middle elements of an arrayeqArrays(array1, array2)
: returns true or false based on if the compared arrays are equalassertEqual(actual, expected)
: console.logs if the two compared primitive values are the same or noteqObjects(object1, object2)
: returns true or false based on if the compared objects are equalassertObjectsEqual(actual, expected)
: console.logs if the two compared objects are equalcountLetters(string)
: counts how many letters are in a string and returns results in an objectcountOnly(array, object)
: counts the number of times an element appears in an array based on an object specifying what to countfindKey(object, callback)
: returns an objects key based on a condition set by the callback functionfindKeyByValue(object, lookFor)
: returns the value of an objects key that matches the lookFor parameterletterPositions(string)
: returns an array with all the indexs of each letter in the stringmap(array, callback)
: returns a new array that has applied a callback function to each element of the inputted arraytakeUntil(array, callback)
: returns an array with all elements until the given condition from the callback function is metwithout(array, itemsToRemove)
: returns an array that takes out all elements from the itemsToRemove input
1.0.0
2 years ago