@ridabatool/lotide
v1.0.0
Published
An npm package that provides javascript functionalities similar to lodash library
Downloads
2
Readme
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 @ridabatool/lotide
Require it:
const _ = require('@ridabatool/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: returns the value at the first index position in an arraytail(array)
: returns the array excluding the first value of the arraymiddle(array)
: returns the middle value in an arraycountLetters(string)
: returns an object with letters as key properties and their count in the sentence as valuecountOnly(array, object)
: returns the object of counts of only the elements existing in arrayeqArrays(array, array)
: returns true if arrays are equaleqObjects(object, object)
: returns true if objects are equalfindKey(object, callback)
: returns the key if the value of the key matches value of callback functionfindKeyByValue(object, value)
: returns returns the matching key of the value providedletterPositions(string)
: returns an array of the index positions of the stringmap(array, callback)
: returns a new array after implementing the callback function on each element of the array providedtakeUntil(array, callback)
: returns all the elements from start of the array till it matches the callback function conditionwithout(array, itemsToRemove)
: returns the array by removing the elememts provided in itemsToRemove