1.0.1 • Published 2 years ago
@brcfelty/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 @brcfelty/lotide
Require it:
const _ = require('@brcfelty/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: returns the first element in an arraytail(array)
: returns the contents of an array without the first elementmiddle(array)
: returns the elements located at the centre of an arrayassertArraysEqual(actualArray, expectedArray)
: returns an assertion based on if two arrays are equalassertEqual(array1, array2)
: returns an assertion based on if two values are equalassertObjectsEqual(actualObject, expectedObject)
: returns an assertion based on if two objects are equaleqArrays(array1, array2)
: returns true or false if two arrays are equaleqObjects(object1, object2)
: returns true or false if two objects are equalcountLetters(string)
: returns count of each of the letters in that stringcountOnly(allItems, itemsToCount)
: returns counts for a subset of those itemsfindKey(object, condition)
: returns any key that matches the value conditionfindKeyByValue(object, targetValue)
: returns any key that matches the target valueletterPositions(string, targetValue)
: returns the index of where a target letter is foundmap(array, function())
: returns a new array based on the input functionreverse(string)
: returns a new string that has the elements reversedtakeUntil(array, function())
: returns a new array that utilizes the callback function to change the conditionswithout(array, target)
: returns a new array that removes any elements that contain the target