@drizztar/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 @drizztar/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Certainly! Here's the documentation for the functions you provided:
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2): Compares two arraysarr1andarr2and asserts whether they are equal, printing a message to the console.assertEqual(actual, expected): Comparesactualandexpectedvalues and asserts whether they are equal, printing a message to the console.assertObjectsEqual(obj1, obj2): Compares two objectsobj1andobj2and asserts whether they are equal, printing a message to the console.countLetters(str): Counts the occurrences of each letter in a given stringstrand returns an object with letter counts.countOnly(allItems, itemsToCount): Counts the occurrences of specified items in an arrayallItemsbased on the criteria specified initemsToCountand returns an object with item counts.eqArrays(arr1, arr2): Compares two arraysarr1andarr2and returnstrueif they are equal,falseotherwise.eqObjects(obj1, obj2): Compares two objectsobj1andobj2and returnstrueif they are equal,falseotherwise.findKey(obj, callback): Searches for a key in an objectobjbased on the provided callback functioncallbackand returns the first key for which the callback returnstrue.findKeyByValue(obj, value): Searches for a key with a specifiedvaluein an objectobjand returns the key if found, orundefinedif not found.flatten(arr): Flattens a nested arrayarrand returns a flattened one-dimensional array.head(arr): Returns the first element of an arrayarr.letterPositions(str): Returns an object with the positions of each letter in a given stringstr.map(arr, callback): Applies a callback functioncallbackto each element in an arrayarrand returns a new array with the results.middle(arr): Returns the middle element(s) of an arrayarr.tail(arr): Returns a new array containing all elements of the input arrayarrexcept for the first element.takeUntil(arr, callback): Returns a new array with elements from the beginning of the input arrayarruntil the callback functioncallbackreturnstrue.without(source, itemsToRemove): Returns a new array containing all elements from thesourcearray except for those specified initemsToRemove.
2 years ago