A mini clone of the Lodash library.
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.
Install it:
npm install @marcschul/lotide
Require it:
const _ = require('@marcschul/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: tests 2 given arrays for equalityassertEqual(actual, expected)
: tests primitive for equalityassertObjectsEqual(actual, expected)
: tests objects for equalitycountLetters(sentance)
: return the amount of letters found in a sentancecountOnly(allItems, itemsToCount)
: counts items in an arrayeqArrays(array1, array2)
: return true or false if arrays are equal to each othereqObjects(object1, object2)
: return true or false if objects are equal to each otherfindKey(object, callback)
: return first key given a func callbackfindKeyByValue(object, value)
: return first key given a valueflatten(array)
: given a nested array, return array with no nestinghead(array)
: return first index found in an arrayletterPositions(sentance)
: Given an object, return the index position of each lettermap(array, callback)
: Given an array and a func, creates a shallow copy of array and return the array.middle(array)
: return the middle element of an arraytail(array)
: return the tail element of an array. If array has no tail return empty arraytakeUntil(array, callback)
: return shallow copy of an filtered arraywithout(source, itemsToRemove)
: return items from source array that are not in itemsToRemove array.