1.0.0 • Published 3 years ago
@spencerb242/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 @spencerb242/lotide
Require it:
const _ = require('@spencerb242/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEquals(a1, a2): Checks if arrays are equal and prints assertion message to consoleassertEqual(element1, element2): Checks if two variables are equal using === operatorassertObjectEquals(o1, o2): Checks if objects are equal and prints assertion message to consolecountLetters(string): Count number of letters in a string excluding whitespacescountOnly(arr, itemsToCount): Returns a number with the amount of items found in arr with whats in the itemsToCount arrayeqArrays(a1, a2): Checks if arrays are equaleqObjects(o1, o2): returns true if objects are equal, false if notfindKey(object, callback): Finds key in object callback finds matching valuefindKeyByValue(object, value): Returns key if value of object equals searched valueflatten(array): Removes nested arrayshead(array): Returns first element in arrayletterPositions(string): Returns the letters and their positions in the stringmap(arr, callback): Maps callback function onto each element of arr and returns new array without affected originalmiddle(array): Returns middle element in the array, if even returns bothtail(array): Returns the tail end of the array, without the headtakeUntil(array, callback): Returns new array with array items in order until callback condition is metwithout(array, remove): Returns new array without any items included in the passed in remove array )
1.0.0
3 years ago