1.0.0 • Published 3 years ago
@ahhreggi/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 @ahhreggi/lotide
Require it:
const _ = require('@ahhreggi/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: Evaluate array1 and array2 then log the resultsassertEqual(value1, value2)
: Evaluate value1 and value2 then log the resultsassertObjectsEqual(obj1, obj2)
: Evaluate obj1 and obj2 then log the resultscountLetters(string)
: Return an object containing character counts for each character in stringcountOnly(allItems, itemsToCount)
: Return an object containing instance counts for each element in allItemsallItems
: an array of strings (e.g.,['1', '1', '2']
)itemsToCount
: an object of elements with a boolean value indicating whether or not it should be counted (e.g.,{'1': true, '2': false}
)
eqArrays(array1, array2)
: Evaluate array1 === array2eqObjects(obj1, obj2)
: Evaluate obj1 === obj2findKey(object, callback)
: Return the first key in object for which the callback function returns truefindKeyByValue(object, value)
: Return the first key in object with the given valueflatten(array)
: Return a nested array as a single-level arrayhead(array)
: Return the first element of arrayletterPositions(sentence)
: Return an object containing the indices for which each character in sentence is foundmap(array, callback)
: Return a new array with the results of calling the callback on each element in arraymiddle(array)
: Return the middle element(s) of arraytail(array)
: Return an array containing every element after the head of arraytakeUntil(array, callback)
: Return all elements of array until an element for which the callback function is applied to returns truewithout(source, itemsToRemove)
: Return a new array with elements in source (array) that are not in itemsToRemove (array)
1.0.0
3 years ago