@anshaalhussain/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 @anshaalhussain/lotide
Require it:
const _ = require('@anshaalhussain/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: return the first element of arraytail(array)
: return every element of array after the firstmiddle(array)
: return middle element of an array (returns median of the middle two values if array has even amount of elements)without(array, itemsToRemove)
: removes the specified element from an arraytakeUntil(array, callback)
: returns elements in an array until conditional returned through callbackmap(array, callback))
: returns elements that are returned by the callback. Ex. can use to return first letter of each element map(array, words => word0)letterPositions(string)
: returns an object containing letters and their position from an inputted stringfindKeyByValue(object)
: searches for an returns the key of a value from inputted object
findKey(obj, callback)
: returns boolean for each element in object based on callbackeqObjects(obj1, obj2)
: returns boolean on whether two objects are equal
countOnly(element, itemsToCount)
: returns number of times specified element(s) appear in inputted objectcountLetters(string)
: returns number of letters in specified string
3 years ago