1.0.1 • Published 4 years ago
@rachelpr/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 @rachelpr/lotide
Require it:
const _ = require('@rachelpr/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...): A function to retrieve the first element from an arraytail(...): A functon to retrieve every element in array except for the first onemiddle(...): A function that returns the middle-most elements of the provided arraycountLetters(...): A function that will take in a string and return a count of each letter in the stringcountOnly(...): A function that takes an array and an object and returns the count of everything that the object listedeqArrays(...): A function that compares if two arrays are equaleqObjects(...): A function that will take in two objects and return true or false based on a perfect matchfindKey(...): A function that takes an object and a callback. Returns the first key for which the callback returns truthyfindKeyByValue(...): A function that will take in an object and a value. Returns the first key that contains the given valueflatten(...): A function that takes an array with nested elements and returns a "flattened" versionletterPositions(...): A function that will return all the indices in the string providedmap(...): A function that takes two arguments and returns a new array based on the results of the callbacktakeUntil(...): A function that will keep collecting items from a provided array until the callback provided returns truthywithout(...): A function that will return a subset of elements, removing any that are unwantedassertArraysEqual(...): A function that will take two arrays and test them for equality and print a message to the consoleassertEqual(...): A function that will test if two values are equal and prints an appropriate messageassertObjectsEqual(...): A function that will take in two objects and console.log an appropriate message