@jtardioli/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 @jtardioli/lotide
Require it:
const _ = require('@jtardioli/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArrayEqual(array1, array2, expected): retruns boolean if arrays are equalassertEqual(actual, expected): console logs an error if values are not equalassertObjectsEqual(object1, object2): console logs error if objects are not equalcountLetters(sentence): returns an object with the count of how many times a given letters appears in the sentencecountOnly(allItems, itemsToCount): returns object that counts how many times inputed values appear in an arrayeqArrays(array1,array2): returns boolean if arrays are equaleqObjects(object1, object2): returns boolean if objects are equalfindKey(object, callback): returns the key for the value in the object that makes the callback return truefindKeyByValue(Object, Value): returns the key of the object that matches the valueflatten(array): flattens an arrray by removing its nestinghead(array): returns the first value in an arrayletterPositions(sentece): returns an object with each letter as a key, the value is an array with the indices of where the letter appears in the sentencemap(array, callback): modifies each value in an array as specified by the callbackmiddle(array): returns the middle value of an arraytail(array): returns an array with the first value removedtakeUntil(data, callback): returns an array with all values before the callback returns truetakeUntil(source, itemToRemove): returns an array specified items removed
4 years ago