A mini clone of the Lodash library.
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.
Install it:
npm install @username/lotide
Require it:
const _ = require('@kevinyang-cyen/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: Asserts whether actual array is equal to the expected arrayassertEqual(actual, expected)
: Asserts whether actual value is equal to the expected valueassertObjectsEqual(actual, expected)
: Asserts whether actual object is equal to expected objectcountLetters(string)
: Counts the number of letters in a given stringcountOnly(allItems, itemsToCount)
: Counts the items in a given object within a given arrayeqArrays(arrayOne, arrayTwo)
: Checks whether two given arrays are equaleqObjects(objectOne, objectTwo)
: Checks whether two given objects are equalfindKey(object, callBack)
: Returns the key of the first element predicate returns truthy forfindKeyByValue(objectToSearch, item)
: Returns the key of an given item value within an objectflatten(nestedArray)
: Returns a one level array from a given nested arrayhead(array)
: Returns an array with the first value of the given arrayletterPositions(sentence)
: Returns an object with the count of each letter in a given stringmap(array, callback)
: Creates a new array populated with the results of calling a provided function on every element in the calling arraymiddle(array)
: Returns an array with the middle index value of a given array, returns empty array if given array length is 1 or 0tail(array)
: Returns an array with that excludes the first value of the given arraytakeUntil(array, callback)
: Creates a new array populated with the results of the original array until the callback condition is truewithout(source, itemsToRemove)
: Removes all values from itemsToRemove array from the source array