1.0.0 • Published 4 years ago
@mhassan47/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 @mhassan47/lotide
Require it:
const _ = require('@mhassan47/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2): asserts when two arrays are identicalassertEqual(actual, expected): asserts when two values are identicalassertObjectsEqual(actual, expected): asserts when two objects are identicalcountOnly(allItems, itemsToCount): checks to see if item in array should be countedeqArrays(array1, array2): 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(object, value): 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(array): takes in array, counts array length for even or odd and then returns middle value or the averaged value of the middle 2tail(array): takes in array, removes array0 and returns the resttakeUntil(array, callback): takes in array and callback function, return array contents until callback function's requirements are satsifiedwithout(source, itemRemove): takes in 2 arrays, returns a new array without the items in rmvArray
1.0.0
4 years ago