1.0.0 • Published 2 years ago
@gmahant/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 @gmahant/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(eqArrays)
: checks if two arrays are identicalassertEqual(actual, expected)
: test if two values are identicalassertEqualObjects(actual, expected)
: test if two objects are identicalcountLetters(string)
: returns an object that how often a letter occurscountOnly(allItems, itemsToCount)
: counts how many times a given value occurs in an arrayeqArrays(array1, array2)
: checks if two arrays are identicaleqObjects(object1, object2)
: checks if two objects are identicalfindByValue(object, value)
: returns the key of the value providedfindKey(object, callback)
: returns the key in an object that satisfies the callback function providedflatten(array)
: flattens arrays within arrayshead(array)
: returns the first item within an arrayletterPosition(string)
: returns an object containing all the letters and their corresponding indexmap(array, callback)
: loops through an array and applies the callback function to each itemmiddle(array)
: returns the median value(s) of an arraytail(array)
: returns all items in an array excluding the firsttakeUntil(array, callback)
: returns items of an array until provided callback is truewithout(array1, array2)
: returns all items that are not identical between two arrays
1.0.0
2 years ago