1.0.0 • Published 3 years ago
@meghal.shah210/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 @meghalshah210/lotide
Require it:
const _ = require('@meghalshah210/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: function that asserts if two arrays are equalsassertEqual(actual, expected)
: function that asserts if two values are equalsassertObjectsEqual(actual, expected)
: function that asserts if two objects are equalscountLetters(sentence)
: function that returns counts of each letter of a sentencecountOnly(allItems, itemsToCount)
: function that takes an array and returns counts for a specific subset mentioned in itemsToCounteqArrays(actual, expected)
: function that performs comparison between two arrays to determine if they are equivalenteqObjects(object1, object2)
: function that performs comparison between two objects to determine if they are equivalentfindKey(object, callback)
: function that scans the object and return the first key for which the callback returns a truthy valuefindKeyByValue(object, value)
: function returns key for value in given object if it existsflatten(array)
: function that flattens an array of arrays into a single-level arrayhead(array)
: function that returns the first element from the arrayletterPositions(sentence)
: function that returns all the indices for each character in the sentencemap(array, callback)
: function that transforms the array based on callback and returns new arraymiddle(array)
: function that returns the middle elements of an arraytail(array)
: function that retrieves all but first element of the arraytakeUntil(array, callback)
: function that returns elements of the array from beginning until callback condition is satisfiedwithout(source, itemsToRemove)
: function that removes elements mentioned in itemsToRemove from source array
1.0.0
3 years ago