1.0.0 • Published 4 years ago
@bryce-mcmath/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 @bryce-mcmath/lotide
Require it:
const _ = require('@bryce-mcmath/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(value1, value2)
: compares two values with strict equalityassertArraysEqual(array1, array2)
: recursively compares arrays that may contain subarraysassertObjectsEqual(object1, object2)
: recursively compares objects that may contain objects and arrayseqArrays(array1, array2)
: returns true if arrays are equal, false otherwise. Uses recursion if array contains arrayseqObjects(object1, object2)
: returns true if objects are equal, false otherwise. Uses recursion if object contains objectscountLetters(string)
: returns an object that lists the count of each letter used in a given stringcountOnly(array, object)
: returns a count object that lists the count of each occurence of a key in the input object included in the input arrayletterPositions(string)
: returns an object with key value pairs that list arrays of each position that a given letter has in the input stringfindKey(object, callback)
: returns the first key of the input object that satisfies the given callbackflatten(array)
: returns a one dimensional array when given a multidimensional arrayhead(array)
: returns an array of the first element of the input arraytail(array)
: returns an array of every element of an array less the first elementtakeUntil(array, callback)
: returns an array of each element until an element that passes the callback is reachedwithout(array1, array2)
: returns a copy of the first array that doesn't include any of the items in the second arraymap(array, callback)
: returns an array of values returns by passing the original array values into a callback
Running Tests
In the root directory:
npm test
1.0.0
4 years ago