1.0.0 • Published 2 years ago
@zaraahkhan/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 @zaraahkhan/lotide
Require it:
const _ = require('@zaraahkhan/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1,array2)
: checks if two arrays are equal and displays the resultassertEqual(actual,expected)
: checks if the actual/a given string is equal to the expected stringassertObjectsEqual(object1,object2)
: checks if two objects are equal and displays the resultcountLetters(string)
: returns the number of times a character appears in a given stringcountOnly(allItems,itemsToCount)
: counts the number of times a given element appears in a given arrayeqArrays(array1,array2)
: returns if two arrays are equaleqObjects(object1,object2)
: returns if two objects are equalfindKey(object,callBackfn)
: returns the value of a key in a given objectfindKeyByValue(object,value)
: returns the key of a given value in a given objectflatten(array)
: flattens an array; when given an array of arrays converts it into a single arrayhead(array)
: returns the first element of the arrayletterPositions(string)
: returns an array of the indices/index of a character in a stringmap(array,callBackFunction)
: returns an array after implementing an operation(mentioned in the call back function) on every element of the arraymiddle(array)
: returns the middle element(s) of the arraytail(array)
: returns all element(s) of the array except the first elementtakeUntil(array, callBackFunction)
: returns the element(s) of the array until it satisfies the call back functionwithout(sourceArray, itemsToRemoveArray)
: returns an array after removing elements that are in the itemsToRemoveArray
1.0.0
2 years ago