1.0.0 • Published 3 years ago
@thien-trieu/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 @username/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...): Returns first element of anarray.tail(...): Returns a newarrayof all elements except for the first element.middle(...): Returns a newarraywith the middle element(s) of an array. If no middle, then and empty array is returned.countOnly(...): Returns a new object with the sum of each element found true fromitemsToCountinallitems.countLetter(...): Returns a new object with the sum of each letter from astring.without(...): Returns a new array with only the elements fromsourcethat are not present in theitemsToRemovearray.findKey(...): Returns the first key that matchescallbackfor aninputobject. If no matches found,undefinedis returned.findKeyByValue(...): Returns key of anobjectby searching for a matchingvalue. If no matches found,undefinedis returned.letterPosition(...): Returns an object with the sum of each letter from astring.map(...): Returns a newarraywith the elements that return a truthy value from thecallback.takeUntil(...): Returns a new array with elements taken from the beginning until thecallbackreturns atruthyvalueassertEqual(...): Returns a pass or fail console.log if assertion equals true or false when comparing the values of two primitives usingactualandexpected.eqArrays(...): Returns a true or false value when comparing if the values of two arrays are equal.assertArraysEqual(...): Returns a pass or fail console.log if assertion equals true or false when comparing the values of two arrays.eqObjects(...): Returns a true or false value when comparing if the values of two objects are equal.assertObjectsEqual(...): Returns a pass or fail console.log if assertion equals true or false when comparing the values of two objects.
1.0.0
3 years ago