1.0.0 • Published 4 years ago
@splcurran/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 @splcurran/lotide
Require it:
const _ = require('@splcurran/lotide');
Call it:
const results = _.head([1, 2, 3]) // => 1
Documentation
The following functions are currently implemented:
countOnly(allItems, itemsToCount)
: counts elements from listallItems
as defined properties with truthy values initemsToCount
eqArrays(list1, list2)
: shallow equality check for arrayseqObjects(obj1, obj2)
: shallow equality check for objectsfindKey(obj, test)
: return the first key inobj
whose value passes functiontest
findKeyByValue(obj, value)
: return the first key inobj
whose value isvalue
head(list)
: returns the first element of the listmap(list, func)
: returns a new array where each element is the result of passing the corresponding element fromlist
intofunc
middle(list)
: returns a list with 1 or 2 elements which are in the middle oflist
takeUntil(list, test)
: returns a new list of all the elements oflist
up to, but not including, the first which passes functiontest
without(source, itemsToRemove)
: Returns an array resulting from removing all copies of the elements initemsToRemove
fromsource
1.0.0
4 years ago