1.0.0 • Published 5 years ago
@wdportman/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 @wdportman/lotide
Require it:
const _ = require('@wdportman/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(...): Assert whether two arrays are equalassertEqual(...): Assert whether two primitive values are equalassertObjectsEqual(...): Assert whether two objects are equalcountLetters(...): Count the number of times each letter occurs in a given stringeqArrays(...): Check if two arrays are equaleqObjects(...): Check if two objects are equalfindKey(...): Takes in an object and a callback. It scans the object and returns the first key for which the callback returns a truthy value.findKeyByValue(...): Takes in an object and a value. It scans the object and returns the first key which contains the given value.flatten(...): Take in an array containing elements including nested arrays of elements, and returns a "flattened" version of the arrayhead(...): Returns the first value of an array.letterPositions(...): Returns all the indices (zero-based positions) in the string where each character is found.map(...): Takes in an array to map and a callback function. Returns a new array based on the results of the callback function.middle(...): Returns the middle value of an array.tail(...): Returns all but the first value of an array.takeUntil(...): Collects items from a provided array until the callback provided returns a truthy value.without(...): Returns a subset of a given array, removing unwanted elements.
1.0.0
5 years ago