1.0.1 • Published 1 year ago
@jsc604/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 @jsc604/lotide
Require it:
const _ = require('@jsc604/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: prints true or false when comparing if 2 arrays are equalassertEqual(actual, expected)
: prints true or false when comparing if 2 values are equalassertObjectEqual(actual, expected)
: prints true or false when comparing if 2 objects are equalcountLetters(string)
: returns a count of each letter from the input stringcountOnly(allItems, itemsToCount)
: returns a count of the specified item in an arrayeqArrays(array1, array2)
: compares 2 arrays and returns true or falseeqObjects(object1, object2)
: compares 2 objects and returns true or falsefindKey(object, callback)
: finds the first key that contains the value specified in the callbackfindKeyByValue(obj, value)
: finds the first key that contains the value specifiedflatten(input)
: takes and array with nested arrays and returns an array of the same items in the sameorderhead(array)
: returns the first index of an arrayletterpositions(sentence)
: returns an object with the position of each letter from the input stringmap(array, callback)
: returns a copy of a new array edited by the callback on each element of the arraymiddle(array)
: returns the middle element of an array. If the array has an even number of elements, it will return both middle elementstail(array)
: returns the last element of an arraytakeUntil(array, callback)
: returns an array of the same elements in order until the specified value of the callback is triggeredwithout(source, remove)
: removes items specified in remove from the source arrayindex()
: library containing all functions that can be accessed