1.0.1 • Published 5 years ago
@jeffreycao1998/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 @jeffreycao1998/lotide
Require it:
const _ = require('@jeffreycao1998/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArrayEqual(arrayA, arrayB)
: shows pass/fail in console depending if both Arrays are equalassertEqual(itemA, itemB)
: shows pass/fail in console depending if both Variables are equalassertObjectsEqual(objA, objB)
: shows pass/fail in console depending if both Objects are equalcountLetters(string)
: returns an object with the number of times each letter occurs in a stringcountOnly(array, itemsToCount)
: returns an object with the number of times each item in itemsToCount appears in a array.eqArrays(arrayA, arrayB)
: returns true if both arrays are equaleqObjects(objA, objB)
: returns true if both objects are equalfindKey(object, callback)
: returns key if callback(object.key) is truefindKeyByValue(object, value)
: returns key if it exists in object, otherwise returns undefinedflatten(array)
: returns flat array with no nestinghead(array)
: returns the first element of an arrayletterPositions(sentence)
: returns an object that shows every letter in the string and the index's they appear in the stringmap(array, callback)
: return a new array after calling a callback function on each item in the given arraymiddle(array)
: return the middle of the array, if the middle has 2 elements return both.tail(array)
: return a array without the first elementtakeUntil(array, callback)
: return an array up to the point where the callback on the item in the array returns truewithout(array, itemsToRemove)
: return an array without any items that occurs in itemsToRemove