1.0.0 • Published 3 years ago
@panoramine/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 @panoramine/lotide
Require it:
const _ = require('@panoramine/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
tail(array)
: returns every element of the array except te first onemiddle(array)
: take in an array and return the middle-most element/s of the given arrayhead(array)
: returns the first item in the arrayassertArraysEqual(array1, array2)
: take in two arrays and console.log an appropriate message to the consoleassertEqual(actual, expected)
: compares two values it takes in and print out a message telling us if they match or notassertObjectsEqual(actual, expected)
: take in two objects and console.log an appropriate message to the consolecountLetters(string)
: return count of each letter in a given stringcountOnly(allItems, itemsToCount)
: return an object containing counts of everything that the input object listedeqArrays(array1, array2)
: takes in two arrays and returns true or false, based on a perfect matcheqObjects(obj1,obj2)
: take in two objects and returns true or false, based on a perfect matchfindkey(obj, callback)
: takes in an object and a callback and return the first key for which the callback returns a truthy valuefindKeyByValue(obj, value)
: given an object and a value will return the key to that valueflatten(array)
: take in an array containing elements including nested arrays of elements, and return a "flattened" version of the arrayletterPositions(string)
: return object with positions for every letter in a given stringmap(array, callback)
: return a new array based on the results of the callback functiontakeUntil(array, callback)
: keep collecting items from a provided array until the callback provided returns a truthy valuewithout(source, itemsToRemove)
: return a subset of a given array, removing unwanted elements
1.0.0
3 years ago