1.0.0 • Published 4 years ago
@justinl/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 @justinl/lotide
Require it:
const _ = require('@justinl/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2): asserts if two arrays are identicalassertEqual(actual, expected): asserts if two values are identicalassertObjectsEqual(actual, expected): asserts if two objects are identicalcountLetters(stringInp): takes in string, outputs an object containing number count value of each letter that appearscountOnly(allItems, itemsToCount): takes in an array and an object, returns new object that contains the count of all array elements present in objecteqArrays(arr1, arr2): checks to see if two arrays are equaleqObjects(object1, object2): checks to see if two objects are equalfindKey(object, callback): takes in object, and callback condition. if object contains callback condition, return keyfindKeyByValue(obj, val): takes in an object and a key, loops through object looking for the keyhead(array): takes in array, returns first value in the arrayletterPositions(sentence): takes in a string, returns object with letter positionsmap(array, callback): takes in array and callback function, returns array after modification of callback functionmiddle(firstArray): takes in array, counts array length for even or odd and then returns middle value or the averaged value of the middle 2tail(arr): takes in array, removes arr0 and returns the resttakeUntil(array, callback): takes in array and callback function, return array contents until callback function's requirements are satsifiedwithout(orgArray, rmvArray): takes in 2 arrays, returns a new array without the items in rmvArray
1.0.0
4 years ago