1.0.0 • Published 4 years ago
@houseofsam/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 @houseofsam/lotide
Require it:
const _ = require('@houseofsam/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(...)
: Asserts if 2 values are equaleqArrays(...)
: Compares 2 arrays and returns true if they a perfect matcheqObjects(...)
: Compares 2 objects and returns true if they a perfect matchassertArraysEqual(...)
: Verbosely and colourfully asserts if 2 arrays are equalassertObjectEqual(...)
: Verbosely and colourfully asserts if 2 objects are equalhead(...)
: Returns the first element of a provided arraytail(...)
: Returns an entire provided array except the first elementmiddle(...)
: Returns the middle element(s) of a provided arrayflatten(...)
: Flatten a provided nested array into a single-level arraycountOnly(...)
: Take in a collection of items and return counts for a specific subset of those itemscountLetters(...)
: Take in a sentence (as a string) and then return a count of each of the letters in that sentenceletterPositions(...)
: Given a provided string, function will return all the indices (zero-based positions) in the string where each character is foundfindKey(...)
: Takes in an object and a callback. Function will scan the object and return the first key for which the callback returns a truthy valuefindKeyByValue(...)
: Given an object and a value, function will scan the object and return the first key which contains the given valuetakeUntil(...)
: Collect & return items from a provided array until the callback provided returns a truthy valuewithout(...)
: Returns a subset of a provided array, removing unwanted elementsmap(...)
: Given a provided array, function will return a new array based on the results of a callback function, similar to Array.prototype.map
1.0.0
4 years ago