1.0.0 • Published 6 months ago
@vwong02/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 @vwong02/lotide
Require it:
const _ = require('@vwong02/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual,expected)
: Takes in two arrays and asserts if they are equal or notassertEqual(actual, expected)
: Takes in two values and asserts if they are equaleqArray(x, y)
: Takes in two arrays and compares themassertObjectEqual(actual, expected)
: Takes in two objects and asserts if they are equalcountLetters(sentence)
: Takes in an array of strings and returns an object with the letter count for each lettercountOnly(allItems,ItemsToCount)
: Takes in an array of strings and returns an object with the appropriate counts.eqObjects(Object1, Object2)
: Takes in two objects compares themfindKey(obj, callback)
: Takes in an object and a callback. It will traverse the object and return the first key for which the callback returns a truthy value. If no key is found, then it will return undefined.findKeyByValue(obj, value)
: Takes in an object and a value. Scan an object and return the first key which returns the given valuehead(array)
: Returns the first element of an arrayletterPositions(sentence)
: Returns all the indicies in the string where each character is found.map(array, callback)
: Takes in an array and a callback and returns a new array after using the callback function on each element of the arraymiddle(array)
: Takes in an array and returns the middle index. If there is two numbers, returns the middle two indexes.tail(array)
: Retrieves all elements of an array except the first one.takeUntil(array,callback)
: Takes in an array and returns a slice of the array taken from the beginningwithout(source, itemsToRemove)
: Takes in an array and itemsToRemove returning a new array with the items removed
1.0.0
6 months ago