1.0.0 • Published 5 years ago
@bshaw89/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 @bshaw89/lotide
Require it:
const _ = require('@bshaw89/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2)
: compares two arrays and asserts a positive or negative message if they are/are not equalassertEqual(actual, expected)
: compares two arguments and asserts a positive or negative message if they are/are not equalassertObjectsEqual(object1, object2)
: compares two objects and asserts a positive or negative message if they are/are not equalcountLetters(letters)
: returns the number of times each letter in the argument appearscountOnly(allItems, itemsToCount)
: returns the number of times the itemsToCount appear in allItemseqArrays(arr1, arr2)
: compares two arrays to see if they are equaleqObjects(object1, object2)
: compares two objects to see if they are equalfindKey(object, callback)
: searches for a key within the object and executes the callback function on the keyfindKeyByValue(object, value)
: returns the object keys that match the valuehead(arrFirst)
: returns the first element in an arrayletterPositions(sentence)
: returns the index positions of each letter in a sentencemap(array, callback)
: returns the first element of each item in an arraymiddle(array)
: returns the middle element in an arraytail(arrLast)
: returns the last element in an arraytakeUntil(array, callback)
: returns a new array of each item in the original array up until a stopping condition define in the callbackwithout(source, itemsToRemove)
: returns an array without the itemsToRemove
1.0.0
5 years ago