@abellozo/lotide
v1.0.0
Published
A mini clone of the [Lodash](https://lodash.com) library (project created and published by me as part of my learnings at Lighthouse Labs)
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 @abellozo/lotide
Require it:
const _ = require('@abellozo/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 elements of an array, except the first (index 0)middle(...)
: returns the middle element of an arrayassertArraysEqual(...)
: checks if two arrays are equalsassertEqual(...)
: checks if two values are equalsassertObjectsEqual(...)
: checks if two objects are equalscountLetters(...)
: returns a count of each letter in the sentencecountOnly(...)
: returns counts for a specific subset of the items giveneqArrays(...)
: compares two arrayseqObjects(...)
: compares two objectsfindKey(...)
: scans the object and returns the first key for which the callback returns a truthy valuefindKeyByValue(...)
: scans the object and returns the first key which contains the given valueflatten(...)
: takes in an array containing elements including nested arrays of elements, and returns a "flattened" version of the arrayletterPositions(...)
: returns all the indices (zero-based positions) in the string where each character is foundmap(...)
: returns a new array based on the results of the callback functiontakeUntil(...)
: returns a slice of the array with elements taken from the beginningwithout(...)
: returns a subset of a given array, removing unwanted elements