1.0.0 • Published 2 years ago
onesmartcookie 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 @onesmartcookie/lotide
Require it:
const _ = require('@onesmartcookie/lotide');
Call it:
const results = _.head([1, 2, 3]) // => 1
Documentation
The following utility functions are currently implemented:
countOnly(...)
: Given an array of items and the items we're interested in counting return an object that reports the count of each itemeqArrays(...)
: Returns true if two arrays are equaleqObjects(...)
: Returns true if two objects are equalfindKey(...)
: Returns the first key found when a callback returns a truthy value otherwise undefined is returnedfindKeyByValue(...)
: Returns the firsy key that contains the value or undefinedhead(...)
: Retrieves the head of an arrayisEmpty(...)
: Helper to check if an object isEmptymap(...)
: Returns a map of value that performs the callback on each elementsmiddle(...)
: Returns the middle element of an arraytakeUntil(...)
: Return a slice of an array until callback returns truthywithout(...)
: Return an array without the items we want removed
1.0.0
2 years ago