1.0.2 • Published 3 years ago
@porchsal/lotide v1.0.2
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 @porchsal/lotide
Require it:
const _ = require('@porchsal/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2): Compares if two arrays are equalassertEqual(actual, expected): Compares if two data are equalassertObjectsEqual(actual, expected): Compares if two objects are equalcountLetters(string): Count letters from a stringcountOnly(allItems, itemsToCount): Counts required items from an arrayeqArrays(array1, array2): Compares if two arrays are equaleqObjects(object1, object2): Compares if two objects are equalfindKey(object,callback): Retrives an attribute from an objectfindKeyByValue(parameter, value): Retrives an especific attibute from an objectflatten(array): Creates a new array from an original array of arrayshead(array): Returns the fist element in an arraytail(array): Returns a new array without the firs element of the original arrayletterPositions(sentence): Returns a new array with the position of the letters in a stringmap(array, callback): Returns a new array from the callbackmiddle(array): Returns the middle element from an arrayreverse(str): Returns a reversed stringtakeUntil(array, callback): Returns a new array with the elements according with the callbackwithout(source, itemsToRemove): Returns a new array without items provided