1.0.1 • Published 3 years ago
@michaelwangcode/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 @michaelwangcode/lotide
Require it:
const _ = require('@ michaelwangcode/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(...): Prints whether two arrays are equalassertEqual(...): Prints whether two values are equalassertObjectsEqual(...): Prints whether two objects are equalcountLetters(...): Count the number of times each letter appears in a stringcountOnly(...): Count the number of times a name appears in an arrayeqArrays(...): Check if two arrays are equal (deep comparison)eqObjects(...): Check if two objects are equal (deep comparison)findKey(...): Takes an object and callback function and returns the first key that returns truefindKeyByValue(...): Find the key of an object given a valueflatten(...): Flatten an array by one levelhead(...): Return the head of a list (the first element)letterPositions(...): Return indexes of all letters in a stringmap(...): Apply a function to every element of an arraymiddle(...): Return the middle element(s) of an arraytail(...): Return the tail of an array (everything after the first element)takeUntil(...): Takes an array and callback function and returns elements until a truthy valuewithout(...): Remove unwanted items from an array