1.0.1 • Published 3 years ago
@chchchelsay/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 Chelsea Dwarika/@chchchelsay as part of my learnings at Lighthouse Labs.
Usage
Install it:
npm install @chchchelsay/lotide
Require it:
const _ = require('@chchchelsay/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(): compares two arrays and logs assertion message to consoleassertEqual(): compares two values and logs assertion message to consoleassertObjectsEqual(): compares two objects and logs assertion message to consolecountLetters(): takes in string and returns count of each letter occurrence in stringcountOnly(): takes in array & input object; returns new object with counts of everything listed by input objecteqArrays(): compares two arrays and returns true/false based on a perfect matcheqObjects(): compares two objects and returns true/false based on a perfect matchfindKey(): takes in object & callback; returns first key in object that matches callback ===/else undefinedfindKeyByValue(): takes in object & value; looks through object and returns first key that matches value/ else undefinedflatten(): 'flattens' an array that contains nested arrays of elements into a new un-nested onehead(): returns first item in an arrayletterPositions(): returns indices for where each character is found in a stringmap(): takes in array & callback function; returns new array based on callback function resultstail(): returns everything BUT the first item/head in an arraytakeUntil(): takes in array and callback function; returns slice of array elements until callback function evaluates to true.middle(): returns middle-most element(s) of an arraywithout(): returns subset of given array without specified unwanted elements