@richerob/lotide
v1.0.0
Published
various functions for arrays, objects, and strings
Downloads
3
Readme
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 @richerob/lotide
Require it:
const _ = require('@richerob/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: returns the first element of an arraytail(...)
: returns the last two elements of an arraymiddle(...)
: returns the middle element / elements of an arrayassertArraysEqual(...)
: compares two arrays and returns assertion passed if equal or assertion failed if not equaleqArrays(...)
: compares two arrays and returns true if equal or false if notassertEqual(...)
: compares two strings and returns assertion passed if equal or assertion failed if not equalassertObjectsEqual(...)
: compares two objects and returns assertion passed if equal or assertion failed if not equaleqObjects(...)
: compares two objects and returns true if equal or false if not equalcountLetters(...)
: returns the count of each character in the stringcountOnly(...)
: returns the count of how many times an element is contained in an arrayfindKey(...)
: returns the key value for a property valuefindKeyByValue(...)
: returns the key value of an object's property valueletterPositions(...)
: returns the index value of for each character in a stringmap(...)
: returns a new array based on the original array and callback functiontakeUntil(...)
: returns a new array based on the original array and callback function argumentwithout(...)
: returns a new array based on the original array based on the filtered criteria of the callback function argument