1.0.1 • Published 3 years ago
@alexhauka/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 @alexhauka/lotide
Require it:
const _ = require('@alexhauka/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: logs assertion of array comparisonassertEqual
: logs assertion of comparisonassertObjectsEqual
: logs assertion of object comparisoncountLetters
: returns object with properties comprised of unique letters found (excluding whitespace) and letter countcountOnly
: takes an array and an object; scans array, using object for comparison; returns new objecteqArrays
: returns boolean after comparing arrayseqObjects
: returns boolean after comparing objectsfindKey
: takes an object and a callback; returns object property if matching callbackfindKeyByValue
: takes an object and value; returns object's key matching value (if any)flatten
: takes nested arrays and flattens them to a single arrayhead
: returns first index value of arrayletterPositions
: returns an object with properties comprised of unique letters found and their indexesmap
: takes an array and a callback; performs callback on array before returning new arraymiddle
: returns middle index value of array (returns two index's values if array length is even)tail
: removes first index of array (without destroying original); returns new arraytakeUntil
: takes an array and callback; returns new array up to (but not including) callbackwithout
: takes an array, and an array of values to exclude; returns new array (without exclusions)