1.0.1 • Published 3 years ago
@erikkay/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 @erikkay/lotide
Require it:
const _ = require('@erikkay/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function1(...)
: descriptionassertArraysEqual(ar1, ar2)
: Compares two arrays with eqArrays and prints a reader friendly logassertEqual(actual, expected)
: Compares if expected value === actual valueassertObjectsEqual(object1, object2)
: Compares two objects to ensure they are equalcountLetters(sentance)
: Counts the number of letters in a string then returns an object containing num of each letters occurrencecountOnly(allItems, itemsToCount)
; Counts the number of occurances in an object with an object determining what to counteqArrays(ar1, ar2)
: Ensure the arrays are entirely equaleqObjects(object1, object2)
: Ensures the objects are entirely equalfindKeyByValue(objectToRead, valueToFind)
: Finds a key in an object based on valuefindKey(object, callback)
: Calls the callback function on each item until it returns true, returning that itemflatten(arr)
: Converts a 2d array into 1dhead(array)
: Returns the head of an array (first element)letterPositions(sentence)
: Returns an object containing all the letter in a string with the number of occurrencesmap(array, callback)
: callback is executed on each item in an array, returning the resultmiddle(arr)
: returns the middle array, one for odd, two for even lengthtail(array
: Returns the tail of an array (everything minus first element)takeUntil(array, callback)
: Returns items of the array up until the conditions of the callback function has been metwithout(arSrc, itemsToRemoveAr)
: Removes the items to remove from the array