1.0.0 • Published 4 years ago
@eleisinger/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 @eleisinger/lotide
Require it:
const _ = require('@eleisinger/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countOnly(array, key)
: counts the number of instances akey
occurs in a givenarray
eqArrays(array1, array2)
: compares two arrays and determines if they are equivalenteqobject(object1, object2)
: compares two objects and determines if they are equivalentfindKey(object, key)
: searches an object for a given key and returns the valuefindKeyByValue(object, key)
: searches an object for a given key and returns the entire elementflatten(array)
: converts all items in a nested array to a single arrayhead(array)
: returns the first value in an arraymap(array, function)
: applies a given function to every item in an arraymiddle(array)
returns the median of a given array.- returns one value if
array.length
is odd - returns two values if
array.length
is even
- returns one value if
tail(array)
: returns all values of an array minue index0takeUntil(array, function)
: returns all values of an array until reaching a value whose conditions are defined by the function passedwithout(array, item)
: returns an array minus any items matching the item passed
1.0.0
4 years ago