1.0.0 • Published 3 years ago
@samma_su/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 @samma_su/lotide
Require it:
const _ = require('@samma_su/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(arr): returns 1 for 1, 2, 3.tail(arr): returns 2, 3 for 1, 2, 3.middle(arr): returns [] for 1 or 1, 2; 2 for 1, 2, 3; 2, 3 for[1, 2, 3, 4].assertArraysEqual(actual, expected): test function for eqArrays.assertEqual(actual, expected): test function for functions with primitivevalues as output.assertObjectsEqual(actual, expected): test function for eqObject.countLetters(str): returns the count of each letter in the string.countOnly(allItems, itemsToCount): returns the count of item(s) in allItems,specified in itemsToCount. Returnsunidentified if item not specified.eqArrays(arr1, arr2): compares two arrays and return true or false.eqObject(obj1, obj2): compares two objects and return true or false.findKey(obj, callback): returns key based on the condition specified bythe callback function.findKeyByValue(obj, value): returns key of input value.letterPositions(str): returns the indices of each letter in the string.map(array, callback): returns a new array with results from the callback onevery element in the calling array.takeUntil(array, callback): returns a new array with values takenincrementally from the calling array untilcondition specified by the callback is met.without(source, itemsToRemove): returns a new array with all elements fromthe source input expect element specified byitemsToRemove.
1.0.0
3 years ago