1.0.0 • Published 3 years ago
@jasondi/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 @jasondi/lotide
Require it:
const _ = require('@jasondi/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function assertArraysEqual(...): assert 2 arrays if equal or notfunction assertEqual(...): assert 2 parameters (num, string, ... etc.) if equal or notfunction assertObjectsEqual(...): assert 2 objects if equal or notfunction countLetters(...): count letters in a stringfunction countOnly(...): take 2 parameters, count only as the second parameter requiresfunction eqArrays(...): compare 2 arrays if equal or notfunction eqObjects(...): compare 2 objects if equal or notfunction findKey(...): take 1 object, 1 callback function, find the key in the object based on the output value from the callback functionfunction findKeyByValue(...): take 1 object, 1 value, find the key in the object that has the same value as the second parameterfunction head(...): find the 1st element in an arrayfunction letterPositions(...): find the letter index in a stringfunction map(...): take 1 array, 1 callback function, return a new array based on calling the callback functionfunction middle(...): find all the middle elements in an arrayfunction tail(...): find the last element in an arrayfunction takeUntil(...): take 1 array, 1 callback function, find all matched elements in the array based on calling the callback function
1.0.0
3 years ago