1.0.4 • Published 3 years ago
@devvaru/lotide v1.0.4
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 @devvaru/lotide
Require it:
const _ = require('@devvaru/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(actual, expected): takes in two primitive values and logs whether they are equalassertArraysEqual(arr1, arr2): takes in two arrays and logs whether they are equaleqArrays(arr1, arr2): takes in two arrays and returns true or false whether they are equalassertObjectsEqual(actual, expected): takes in two objects and logs whether they are equaleqObjects(object1, object2): takes in two objects and returns true or false whether they are equalhead(arr): returns the first value in an arraytail(arr): returns array without the first value in the arraywithout(srcArr, itemsToRemoveArr): takes in a source array and an array with items to remove. Returns a new array with the items removedflatten(arr): returns a non nested array from a nested arraymiddle(arr): returns the middle value(s) of an arraycountOnly(allItemsArr, itemsToCountObj): returns the amount of times a value (itemsToCountObj) appears in an array (allItemsArr), if the value is truthycountLetters(sentence): returns the amount of times a letter appears in an objectletterPositions(sentence): returns the index(es) of a letter in a stringfindKeyByValue(obj, val): returns the key of an object based on the valuemap(arr, callback): returns a new array after iterating over each element of a given arraytakeUntil(arr, callback): iterates over and returns an array up until a condition is metfindKey(obj, callback): returns the key of a nested object based on a nested value