1.0.2 • Published 2 years ago
@aneikusa/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 @aneikusa/lotide
Require it:
const _ = require('@aneikusa/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: Logs "😁😁😁 Assertion Passed" or "📛📛📛 Assertion Failed" when compairing if two arrays are equalassertEqual(actual, expected)
: Logs "😁😁😁 Assertion Passed" or "📛📛📛 Assertion Failed" when compairing an actual versus expected valueassertObjectsEqual(object1, object2)
: Logs "😁😁😁 Assertion Passed" or "📛📛📛 Assertion Failed" when compairing if two objects are equalcountLetters(string)
: Returns an object with the count of a specific character within a stringcountOnly(allItems, itemsToCount)
: Returns the count of specific items within a collectioneqArrays(array1, array2)
: Checks if array1 is equal to array2eqObjects(object1, object2)
: Checks if object1 is equal to object2findKey(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(array)
: Returns a flattened version of a nested arrayhead(array
: Returns the first element of an arrayletterPositions(string)
: Returns all the indices in the string where each character is foundmap(array, callback
: Accepts an array and returns the middle element(s) of the arraymiddle(array)
: Accepts an array and returns the middle element(s) of the arraytail(array)
: Returns the tail of an array (all elements besides first one)takeUntil(array, callback)
: Accepts an array and returns the middle element(s) of the arraywithout(source, itemsToRemove)
: Accepts an array and returns the middle element(s) of the array