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 listallItemsas defined properties with truthy values initemsToCounteqArrays(list1, list2): shallow equality check for arrayseqObjects(obj1, obj2): shallow equality check for objectsfindKey(obj, test): return the first key inobjwhose value passes functiontestfindKeyByValue(obj, value): return the first key inobjwhose value isvaluehead(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 fromlistintofuncmiddle(list): returns a list with 1 or 2 elements which are in the middle oflisttakeUntil(list, test): returns a new list of all the elements oflistup to, but not including, the first which passes functiontestwithout(source, itemsToRemove): Returns an array resulting from removing all copies of the elements initemsToRemovefromsource
1.0.0
4 years ago