1.0.0 • Published 1 year ago
@jvillanueva2000/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 @jvillanueva2000/lotide
Require it:
const _ = require('@jvillanueva2000/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2): function to assert if 2 arrays are equal to each otherassertEqual(arg1, arg2): function to assert if 2 arguments are equal to each otherassertObjectsEqual(obj1, obj2): function to assert if 2 objects are equal to each othercountLetters(string): function to count how many times a certain character appears in a stringcountOnly(sourceArray, conditions): function to count items in an array based on the conditions set in the second argumenteqArrays(arr1, arr2): function to check if 2 arrays are equal to each othereqObjects(obj1, obj2): function to check if 2 objects are equal to each otherfindKey(object, callback): function to find the key value pair of an object that match the criteria of the callback usedfindKeyByValue(object, searchValue): function to find the key of an object that matches the value criteria usedhead(array): function that returns the first element of an arraymiddle(array): function that returns the middle elements of an arraytail(array): function that returns all elements of the array except for the 0th elementletterPositions(sentence): function that returns the positions of a character in the provided stringmap(array, callback): function that returns a new array by mutating the provided array with the provided callbacktakeUntil(array, callback): function that returns a new array that has been sliced up until where the callback specifieswithout(array, itemsToRemove): function that returns the given array having removed the items specified in itemsToRemove
1.0.0
1 year ago