1.0.0 • Published 3 years ago
@etty_barone/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 @etty_barone/lotide
Require it:
const _ = require('@etty_barone/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(actual, expected)
: This function compers two primitive arguments and prints an assertion to the userassertArraysEqual(firstArr, secondArr)
: This function compers between two arrays and prints an assertion to the userassertObjectsEqual(object1, object2)
: This function compers between two objects and prints an assertion to the usereqArrays(firstArray,secondArray)
: This function is being used by assertArraysEqualeqObjects(object1,object2)
: This function is being used by assertObjectsEqualcountLetters(sentence)
: This function recieves a sentence and return an object with the number of apperances for each charcountOnly(allItems, itemsToCount)
: This function recieves a list of items and a list with items that I want to count and returns the number of apperances for each desired item (second list)findKey(obj, callback)
: This function recieves an object and a callback function and returns the key after sending the object to the callback functionfindKeyByValue(bjToSearch, valToSearch)
: This function recieves an object and a value to search and returns the key that holds this valueflatten(arrayToFlatten)
: This function recieves an array of arrays and returns an array with all the elements in one dimensionhead(array)
: This function recieves an array and returns the first elementletterPositions(sentence)
: This function recieves a string and returns an object with all the positions of the charactersmap(array, callback)
: This function recieves an array and a callback function and returns the results of the callback function for each itam in the arraymiddle(array)
: This function recieves an array and returns the middle element/s of ittail(array)
: This function recieves an array and returns the last element of ittakeUntil(array, callback)
: This function recieves an array and a callback function and returns all items until the callback returns falsewithout(source,itemsToRemove)
: This function recieves an array and an item to remove from it and returns the a copy of the array without the itemsToRemovemin(array)
: This function recieves an array and returns the array without the first element
1.0.0
3 years ago