1.0.1 • Published 5 years ago
@hermit_at/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 @hermit_at/lotide
Require it:
const _ = require('@hermit_at/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: return only the first item of an arraytail(...)
: return all items of an array EXCEPT the firstmiddle(...)
: return the item(s) in the midpoint of an arraycountLetters(...)
: return an object that displays the # of times each letter appears in a stringcountOnly(...)
: return the number of instances the desired item(s) appear in an array/stringeqArrays(...)
: determine if the contents and structure of two arrays are equaleqObjects(...)
: determine if the contents and structure of two objects are equalfindKey(...)
: find the first key within an object that contains the desired key-value pairfindKeyByValue(...)
: return the name of the key within an object that contains the desired valueflatten(...)
: return the contents of a nested array in a single arrayletterPositions(...)
: return all of the index positions that letters appear in a stringmap(...)
: return an array based on the result of a callback function exceuted on an arraytakeUntil(...)
: return all items in an array that appear BEFORE the desired stopping valuewithout(...)
: filter an array to return all items that did not appear within our comparable array