1.0.0 • Published 1 year ago
@cshum28/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 @cshum28/lotide
Require it:
const _ = require('@cshum28/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArrayEqual(arr1, arr2)
: takes in arrays as arguments and returns if they are equal or notassertEqual(a, b)
: takes in two arguemnts and returns if they are equal or notassertObjectEqual(obj1, obj2)
: takes in two objects as arguments and returns if they are equal or notcountLetter(sentence)
: takes in sentenance, removes the spaces, and counts the number of letterscountOnly(arr, obj)
: takes in an array and object, look through the object and matches up the array of what is considered true and returning the total count that is true based for the array based on the objecteqArrays(arr1, arr2)
: takes in arrays as arguments and returns true if they are equal and false if they are noteqObjects(obj2, obj2)
: takes in two objects as arguments and returns true if they are equal and false if they are notfindKey(obj, func)
: takes in two arguments (an object and a function), returns the first key in the object if the function matches correctlyfindKeyByValue(obj, string)
: takes takes in two arguments (an object and string), returns the key that matches the string in the objectflatten(arr)
: takes an array and flattens it out, leaving everything inside of just a single arrayhead(arr)
: takes an array and returns the first variable in the arrayletterPositions(sentence)
: takes a sentence as an argument and returns an object which states where all of the letters are positionedmap(arr, callback)
: takes in an arr and callback function, returns the arr after the running it through the callbackmiddle(arr)
: takes in an arr and returns the middle value of the arrtail(arr)
: takes in an arr and returns everything except the first value of the arrtakeUntil(arr, callback)
: takes in an arr and runs it through the callback, the moment the callback is true - return the arr result that contains everything up to the callbackwithout(arr, string)
: takes in an arr and string, removes everything in the arr that is equal to the string
1.0.0
1 year ago