1.0.0 • Published 2 years ago
@wint3rsun/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 @wint3rsun/lotide
Require it:
const _ = require('@wint3rsun/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2)
: prints message whether two array arguments match or notassertEqual(actual, expected)
: prints out a message whether the two values match or notassertObjectsEqual(actual, expected)
: prints out a message whether two objects match or notcountLetters(string)
: returns a count of the number of each letter in a string argumentcountOnly(allItems, itemsToCount)
: returns an object containing counts of everything that the input object listedeqArrays(arr1, arr2)
: given two arrays, returns true or false based on a perfect matcheqObjects(obj1, obj2)
: given two objects, returns true or false based on a perfect matchfindKey(object, callback)
: scans the object and returns the first key for which the callback returns a truthy valuefindKeyByValue(object, value)
: scans the object and returns the first key which contains the given valuehead(array)
: returns the first array element as an arrayletterPositions(sentence)
: returns all the indices in the string where each character is found.map(array, callback)
: returns a new array based on the results of the callback function.middle(array)
: returns the middle-most element(s) of a given arraytail(array)
: returns an array of everything except for the first item of the provided array.takeUnitil(array, callback)
: returns a slice of the provided array with elements taken from the beginning until the callback provided returns a truthy valuewithout(arr, values)
: returns a subset of a given array, removing unwanted elements
1.0.0
2 years ago