1.0.0 • Published 1 year ago
@humairatasnim/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 @humairatasnim/lotide
Require it:
const _ = require('@humairatasnim/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: Compares 2 arrays and confirms if they are equalassertEqual(actual, expected)
: Compares 2 primitive values and confirms if they are equalassertObjectsEqual(actual, expected)
: Compares 2 objects and confirms if they are equalcountLetters(str)
: Returns an object with the total occurances of each letter in the stringcountOnly(allItems, itemsToCount)
: Returns an object with the total occurances of items that appear in arrayeqArrays(arr1, arr2)
: Compares 2 arrays and confirms if they are equaleqObjects(object1, object2)
: Compares 2 objects and confirms if they are equalfindKey(obj, callback)
: Returns the key of an object the value of which meets the callback function criteriafindKeyByValue(obj, val)
: Returns the key of an object the value of which meets the provided valueflatten(arr)
: Returns a flattened array from a nested arrayhead(arr)
: Returns first element of arrayletterPositions(sentence)
: Returns an object with letters as keys and their indices of occurence in the sentence in an array as valuesmap(array, callback)
: Implementation of the built-in Array.Prototype.map() functionmiddle(array)
: Returns middle elements of arraytail(arr)
: Returns array without the first elementtakeUntil(array, callback)
: Returns array with elements until it meets the callback function criteriawithout(source, itemsToRemove)
: Returns array with the items in itemsToRemove removed
1.0.0
1 year ago