1.0.4 • Published 5 years ago
@umrude/lotide v1.0.4
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 @umrude/lotide
Require it:
const _ = require('@umrude/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArrayEqual(arr1, arr2)
: asserts if arrays are equalassertEqual(actual, expected)
: asserts if two strings are equalassertObjectsEqual(actual, expected)
: assertation for if objects are equalcountLetters(strIn)
: counts how many times a letter repeats in a stringcountOnly(allItems, itemsToCount)
: will return an object containing counts of everything that the input object listed.eqArrays(arr1, arr2)
: checks if two arrays are equaleqObjects(obj1, obj2)
: checks if two objects are equalfindKey(input, callback)
: finds the key of a given object and given value by callback functionfindKeyByValue(input, value)
: given a object list, it finds the associated key by looking up the valueflatten(arr)
: takes in an array of arrays and return a "flattened" version of the arrayhead(arr)
: returns first value of given arrayletterPositions(sentence)
: returns the positions of the letters of a given stringmap(array, callback)
: return a new array based on the results of the callback functionmiddle(arr)
: return an array with only the middle element(s) of the provided arraytail(arr)
: returns the "tail" of an array: everything except for the first item (head) of the provided array.takeUntil(arr, callback)
: will keep collecting items from a provided array until the callback provided returns a truthy valuewithout(source, remove)
: returns a subset of a given array, removing unwanted elements without modifying the given array