1.0.0 • Published 3 years ago
@lianc/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 @lianc/lotide
Require it:
const _ = require('@lianc/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(): When entered an array, it only returns the first value within the arraytail(): when entered an array, everything except the first value is returnedmiddle(): When entered an array with at least 3 values, it will return the middle (odd number) or middle 2 value (even number)without(): Accepts 2 arguments, the first array is used and will be filtering the 2nd argument. (ex. without(1,2,3,1) will return 2,3)countOnly(): Accepts 2 arguments, the first one is all the items and the second one is the items you do want to countletterPositions(): Accepts a string and will return the index(es) of the lettercountLetters(): Accepts a string and will return how many time the letter occurseqObjects(): Accepts 2 objects and determines if they are equal returns true or falseeqArrays(): Accepts 2 arrays and determines if they are equal returns true or falseassertArraysEqual(): Asserts if 2 arrays are equal and returns assertion passed or failedassertEqual(): Asserts if 2 data entered are equal and returns assertion passed or failedassertObjectsEqual(): asserts if 2 objects are equal or not and returns assertion passed or failedmap(): takes an array and a callback function. Returns a new array with the function actioned on each element within the arrayfindKey(): Accepts an object and a function. It will return the first key based on the functionfindKeyByValue(): Accepts an object and when provided the value, it will return the first key which this value came from.takeUntil(): takes an array and a callback function. returns a new array with the callback function being the stop condition.
1.0.0
3 years ago