README
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 @BDeWitt-Cohen/lotide
Require it:
const _ = require('@BDeWitt-Cohen/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...): takes single array as argument and returns index[0]tail(...): takes single array as argument and returns everything after index[0] as a new arraymiddle(...): takes single array as argument and returns middle index for odd length array, and middle two indexes for even length arrayassertArraysEqual(arr1, arr2): takes two arguments of arrays and then says whether or not they are equalassertEqual(...): takes two primitive data type arguments and then says whether or not they are equalassertObjectsEqual(...): takes two arguments of objects and then says whether or not they are equalcountLetters(...): takes a string argument, counts the instances of each letter and returns an object with the countcountOnly(...): takes an argument of an array and counts the number of returns the count of itemseqArrays,(...): takes two arguments of arrays and then says whether or not they are equaleqObjects(...): takes two arguments of objects and then says whether or not they are equalfindKey(...): takes two arguments, an object and a helper function and returns a key from the object based on the value input into the helper functionfindKeyByValue(...): takes two arguments, an object and a value and returns the key with that valueflatten(...): takes an array as an argument, if there's a nested array it will return as a single level arrayletterPosition(...): takes a string as an argument and returns an object with each letter from the string as keys and their index position (as an array) as the valuesmap(...): takes two arguments, as array and a callback function, the callback returns index[0] of the wordstakeUntil(...): takes two arguments, an array and callback function, callback is designed to stop at odd number, returns array until the odd numberwithout(...): takes two array arguments and return the first array with any matches from the second array removed