1.0.1 • Published 4 years ago
@rosemaryku/lotide v1.0.1
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 @rosemaryku/lotide
Require it:
const _ = require('@rosemaryku/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(arr): Returns first element of an arraytail(arr): Returns tail of an array (all elements expect first one)middle(array): Returns the middle element(s) of the arrayassertEqual(actual, expected): Logs "✅ Assertion Passed" or "🔴 Assertion Failed" when compairing actual vs expectedassertArraysEqual(arr1, arr2): Logs "✅ Assertion Passed" or "🔴 Assertion Failed" when compairing if two arrays are equalassertObjectsEqual(object1, object2): Logs "✅ Assertion Passed" or "🔴 Assertion Failed" when compairing if two objects are equalcountLetters(str): Returns an object with the count of a specific charactercountOnly(allItems, itemsToCount): Returns the count of specific items in a collectioneqArrays(arr1, arr2): Evaluates if two arrays are equaleqObjects(object1, object2): Evaluates if two objects are equalfindKey(obj, callback): Returns the key that meets the criteria specified by the callback functionfindKeyByValue(obj, value): Returns the first key that contains a given value or undefinedflatten(arr): Returns a flattened version of nested arrayletterPositions(string): Returns return all the indices in the string where each character is foundmap(array, callback): Returns a new array of elements modified by the callback functiontakeUntil(array, callback): Returns a slice of a given array until the callback criteria is metwithout(source, itemsToRemove): Returns a new array without a list of items to remove