1.0.1 • Published 5 years ago
@marcelloak/lotide v1.0.1
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 @marcelloak/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected): compares two arrays and outputs if they are equalassertEqual(actual, expected): compares two primitive values and outputs if they are equalassertObjectsEqual(actual, expected): compares two objects and outputs if they are equalcountLetters(sentence): counts the appearances of unique letters within a sentencecountOnly(allItems, itemsToCount): counts items within a given array that are also within a given objecteqArrays(array1, array2): compares two arrays and returns if they are equaleqObjects(object1, object2): compares two objects and returns if they are equalfindKey(object, callback): finds the first key within the given object that returns true when run through the given callbackfindKeyByValue(object, value): finds the first key within the given object that matches the given valueflatten(nestedArray): returns a flat array given an array with any amount of nestinghead(array): returns the first element within the given arrayletterPositions(sentence): returns an object containing the index(es) of all unique letters within a given sentencemap(array, callback): returns an array with the given callback run on each element of the given arraymiddle(array): returns the middle element(s) of a given arraytail(array): returns the tail of a given array (all elements except the head)takeUntil(array, callback): returns an array with all elements within a given array up to but not including the first element that returns true when run through the given callbackwithout(source, itemsToRemove): returns an array with all elements within a given array except those that are contained within the other given array