1.0.0 • Published 3 years ago
@thameemsh/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 @thameemsh/lotide
Require it:
const _ = require('@thameemsh/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: To retrieve the first element from the arraytail(...)
: To retrieve every element except the head (first element) of the arraymiddle(...)
: To retrieve the middle element of an arraywithout(...)
: Creates an array excluding all given valuestakeUntil(...)
: Will return slice of the array with elements taken from the beginning until the callback/predicate returns a truthy value.map(...)
: Will return a new array based on the results of the callback functionletterPositions(...)
: Will return all the indices (zero-based positions) in the string where each character is foundflatten(...)
: Flattens a given ArrayfindKeyByValue(...)
: Takes in an object and a value scans the object and returns the first key which contains the given valuefindKey(...)
: Takes in an object and a callback and scans the object and returns the first key for which the callback returns a truthy value.eqObjects(...)
: To compare two ObjectseqArrays(...)
: To compare two ArrayscountOnly(...)
:Takes in a collection of items and return counts for a specific subset of those itemscountLetters(...)
:Takes in a sentence (as a string) and then returns a count of each of the letters in that sentenceassertObjectsEqual(...)
: Asserting that two objects are equalassertEqual(...)
: Asserting two boolean valuesassertArraysEqual(...)
: Asserting that two arrays are equal
1.0.0
3 years ago