@se7dev/lotide
v1.0.0
Published
This project was created and published by me as part of my learnings at Lighthouse Labs.
Downloads
69
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 @se7dev/lotide
Require it:
const _ = require('@se7dev/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: Returns first element of an arraytail(array)
: Returns elements after the first element of an arraymiddle(array)
: Returns the element(s) in the middle of an arraycountLetters(string)
: Returns an object with the count of each lettercountOnly(array, object)
: Returns an object with the count of the desired elements based on the passed objectfindKey(object, callback)
: Returns the first key for which the callback returns truefindKeyByValue(object, value)
: Returns the first key that matches the valueflatten(array)
: Returns the flattened arrayletterPositions(string)
: Returns an object with the indexes in which each letter occursmap(array, callback)
: Returns an array with each element transformed by the callbacktakeUntil(array, callback)
: Returns the array up until the element matched the callbackwithout(array, array)
: Returns the array without the elements of the second being presentassertArraysEqual(array, array)
: Logs to the console whether the arrays matchassertEqual(value, value)
: Logs to the console whether the values match (doesn't support objects)assertObjectsEqual(object, object)
: Logs to the console whether an object matches anothereqArrays(array, array)
: Returns true or false depending on whether the arrays matcheqObjects(object, object)
: Returns true or false depending on whether the objects match