1.0.0 • Published 6 years ago
@msiregar/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 @msiregar/lotide
Require it:
const _ = require('@msiregar/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: return first item in arraytail(array)
: return all items in array except the firstmiddle(array)
: take the middle element(s) of an arrayassertArraysEqual(array1, array2)
: take two arrays and console.log appropriate messageassertEqual(actual, expected)
: check if two values are equalassertObjectsEqual(actualObject, expectedObject)
: take two objects and console.log appropriate messagecountLetters(string)
: count letters in a stringcountOnly(array, object)
: take array and object, return object containing total of everything that the input object listedeqArrays(array1, array2)
: check if two arrays are equaleqObjects(object1, object2)
: check if two objects are equalfindKey(object, callback)
: scan the object and return the first key for which the callback returns a truthy value. if no key is found, then it should return undefinedfindKeyByValue(object, value)
: scan object and return the first key which contains the given valueflatten(array)
: take in an array of arrays and flatten to a single-level arrayletterPositions(string)
: return all the indices (zero-based positions) in the string where each character is foundmap(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(array, itemsToRemove)
: return a subset of a given array, removing unwanted elements
1.0.0
6 years ago