1.0.0 • Published 4 years ago
@tomadam/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 @tomadam/lotide
Require it:
const _ = require('@tomadam/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head()
: returns the first item in an array.tail()
: returns everything but the first item in an array.middle
: returns the middle item in an array, if it's length is an even number returns the 2 mid items.eqArrays()
: compares two arrays for equality.countLetters()
: countLetters returns an object with a count of all instences of a letter in a string.countOnly()
: counts all instances of a provided value in an array.eqObject
: compares two objects for equality.findKey()
: returns first key where argument is a match to value.flatten()
: flattens an array of arrays into one arrayletterPosition()
: returns object with indexes of each letter in a given string.map()
: takes 2 arguments, array to map, callback function and returns a new array with the applied callback function.takeUntil()
: takes array and returns new array untill call back is satisfied.without()
: compare arrays and print elements in first array that do not appear in second.
1.0.0
4 years ago