1.0.2 • Published 3 years ago
@j-pilon/lotide v1.0.2
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 @j-pilon/lotide
Require it:
const _ = require('@j-pilon/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
middle(array)
: returns the middle element or elements, if the array is an even numbertail(array)
: returns all the elements of an array except the first elementhead(array)
: returns just the first elements of an arrayassertArraysEqual(array1, array2)
: compares two arrays and returns a pass or a failassertEqual(actual, expected)
: compares if actual parameter results to expected and returns pass or failassertObjectsEqual(object1, object2)
: compares two objects and returns a pass or a failcountLetter(string)
: returns the amount of each letter of that string, besides the spacescountOnly(allItems, itemsToCount)
: returns the number of times the object's keys, itemsToCount, appeared in allItemseqArrays(array1, array2)
: compares two arrays and returns true or falseeqObjects(object1, object2)
: compares objects and returns true or falsefindKey(obj, callback)
: returns the value back based on the callbackfindKeyByValue(value, obj)
: returns the key of the parameter valueletterPositions(sentence)
: returns the index or indices of a lettermap(array, callback)
: preforms the callback on each element and returns a new arraytakeUntil(array, callback)
: pushs the array elements into a new array until the callback is returns trueswithout(array, itemsToRemove)
: removes the itemsToRemove from array