2.0.0 • Published 11 months ago
@shivangi0109/lotide v2.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 @shivangi0109/lotide
Require it:
const _ = require('@shivangi0109/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: which return first element in an arraytail(array)
: which return every element except the head of an arraymiddle(array)
: which return single middle element when array is odd, and two middle element when array is evencountLetters(string)
: which take in a sentence (as a string) and return a count of each of the letters in that sentencecountOnly(array, object)
: which take in a collection of items and return counts for a specific subset of those itemsfindKey(object, callback)
: which takes in an object and a callback and return the first key for which the callback returns a truthy valuefindKeyByValue(object, value)
: which takes in an object and a value and return the first key which contains the given valueflatten(array)
: which return flattened array. Note that this implementation handles one level of nestingletterPositions(string)
: which will return all the indices (zero-based positions) in the string where each character is foundmap(array, callback)
: implement maptakeUntil(array, callback)
: which will keep collecting items from a provided array until the callback provided returns a truthy valuewithout(array1, array2)
: which return array1 elements avoiding array2 elements, if array2 element is same as the array1 elementeqArrays(array1, array2)
: which checks for array's equality and return booleaneqObjects(object1, object2)
: which checks for object's equality and return boolean