1.0.0 • Published 4 years ago
@cynthialeung/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 @cynthialeung/lotide
Require it:
const _ = require('@cynthialeung/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual: asserts if two arrays are equalassertEqual: asserts if two values are equalassertObjectsEqual: asserts if two objects are equalcountLetters: returns the count of each letter in a stringcountOnly: returns the counts for a specific subset of a collection of itemseqArrays: compares two arrayseqObjects: compares two objectsfindKey: returns the first key of an object for which the callback function returns truefindKeyByValue: returns the key of an object when its value matches a given valuehead: returns the first element of an arrayindex: list of all the functions in an objectletterPositions: returns all the indices in the string where each letter is foundmap: calls a provided functions on every element in the array and returns the result in a new arraymiddle: returns the middle element of an arraytail: returns every element in the array except the first elementtakeUntil: returns an array with all the values until the callback returns truewithout: returns an array without the given values
1.0.0
4 years ago