@jacquelinemg/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 @JacquelineMG/lotide
Require it:
const _ = require('@JacquelineMG/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: helps test code by console logging a message confirming or denying that an actual and expected array are equalassertEqual
: helps test code by console logging a message confirming or denying that an actual and expected value are equalassertObjectEqual
: helps test code by console logging a message confirming or denying that an actual and expected object are equalcountLetters
: takes in a string and then return a count of each of the letters in that stringcountOnly
: takes in a collection of items and returns counts for a specific subset of those itemseqArrays
: compares two arrays for a match and returns a true or false booleaneqObjects
: takes in two objects and returns true or false, based on a perfect matchfindKey
: takes in an object and a callback, scan the object and return the first key for which the callback returns a truthy value. If no key is found, then it returns undefinedfindKeyByValue
: takes in an object and a value, scans the object and return the first key which contains the given value. If no key with that given value is found, then it returns undefinedflatten
: flattens nested arrays into single-level arrayhead
: retrieves the first element from the given arrayletterPositions
: returns all the indices in the given string where each character is foundmap
: takes in an array and callback function and will return a new array based on the results of the callback functionmiddle
: returns an array with only the middle element(s) of the provided arraytail
: retrieves all but the first element from the arraytakeUntil
: keeps collecting items from a provided array until the callback provided returns a truthy value. Tt then returns the collected items as new arraywithout
: returns a subset of a given array after removing unwanted elements
12 months ago