1.0.0 • Published 2 years ago
@diavolosz/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 @diavolosz/lotide
Require it:
const _ = require('@diavolosz/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: asserts if two arrays are the sameassertEqual(actual, expected)
: asserts if two values are the sameassertObjectsEqual(actual, expected)
: asserts if two objects are the samecountLetters(stringInput)
: takes in a string, and outputs an object containing the count of each letter that appearedcountOnly(allItems, itemsToCount)
: takes in an array and an object, returns anew object that contains the count of all elements present in that array if satisfy condition listed in objecteqArrays(array1, array2)
: checks to see if two arrays are the sameeqObjects(object1, object2)
: checks to see if two objects are the samefindKey(objectList, callback)
: takes in object, and callback condition. if object contains callback condition, return the keyfindKeyByValue(object, value)
: takes in an object and a key, loops through object and return the keyflatten(input)
: takes in an array of nested arrays, return new array containing all elements without any nested arrayshead(array)
: takes in an array, returns first value in the arrayletterPositions(sentence)
: takes in a string, returns object with the letter positions (index)map(array, callback)
: takes in an array and callback function, returns array after modification by callback functionmiddle(array)
: takes in an array, counts array length to determine even or odd, and then returns middle value if odd and two middle values if eventail(array)
: takes in an array, returns the rest after the first itemtakeUntil(array, callback)
: takes in an array and a callback function, return array items until callback function's requirements are satisfiedwithout(selectedArray, itemsToRemove)
: takes in 2 arrays, returns a new array without the items listed in itemsToRemove
1.0.0
2 years ago