1.0.1 • Published 3 years ago
@mpizzaca/lotide v1.0.1
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 @mpizzaca/lotide
Require it:
const _ = require('@mpizzaca/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(string)
: returns an object containing all individual characters and how many times they occurred in the stringcountOnly(arr[], object)
: counts occurrences of items in the arg1 array if they are present (and truthy) in the arg2 objecteqArrays(arr1[], arr2[])
: returns if two arrays are deeply equaleqObjects(obj1, obj2)
: returns if two objects are deeply equalfindKey(obj, callback)
: returns the first key in an object that satisfies the provided callbackfindKeyByValue(obj, value)
: returns the first key in an object that matches the provided valueflatten(arr[])
: returns a one dimensional array containing all elements from provided (nested) arrayhead(arr[])
: returns the first element from the provided arrayletterPositions(string)
: returns an object containing all unique characters and their index in the stringmap(arr[], callback)
: returns the input array with all elements modified as per the provided callbackmiddle(arr[])
: returns the one (if odd number of elements) or two (if even number of elements) middle elements of the provided arraytail(arr[])
: returns a new array with all elements except the firsttakeUntil(arr[], callback)
: returns a new array starting from the provided array until the callback returns truewithout(arr[], itemsToRemove[])
: returns a new array without the items specified in the second argument