1.0.0 • Published 3 years ago
@jowe81/lotide v1.0.0
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 @jowe81/lotide
Require it:
const _ = require('@jowe81/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(string)
: returns an object with a key for each character, the value indicating the frequency of character instring
countOnly(array, settings)
: returns an object indicating how many times each array item indicated insettings
occurs inarray
eqArrays(array1, array2)
: returns true ifarray1
andarray2
are deeply equaleqObjects(object1, object2)
: returns true ifobject1
andobject2
are deeply equalfindKey(object, callback(item))
: returns the first key fromobject
whose value matches the condition expressed incallback
findKeyByValue(object, value)
: returns the first key fromobject
whose value matchesvalue
flatten(array)
: returns a flattened version ofarray
(nesting allowed)head(array)
: returns the first element ofarray
or the empty arrayletterPositions(string)
: returns an object indicating for each letter instring
where it occursmap(array,callback)
: executescallback
on each element ofarray
and returns an array with the resultmiddle(array)
: returns the middle element(s) ofarray
, or the empty arraytail(array)
: returns a copy ofarray
without its first element, or the empty arraytakeUntil(array, callback)
: returns the first part ofarray
until and excluding the first element that satisfies the condition expressed incallback
withOut(array, array2)
: returns a copy ofarray
that does not contain elements fromarray2
1.0.0
3 years ago