@psran/lotide v1.0.1
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 @psran/lotide
Require it:
const _ = require('@psran/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actualArray, expectedArray): compares if two arrays are equal and prints a statement to the consoleassertEqual(actual, expected): compares if two primitive values are equal and prints a statement to the consoleassertObjectsEqual(actualObject, expectedObject): compares if two objects are equal and prints a statement to the consolecountLetters(str): returns an object with each letter within str as a key and the parameter as its countcountOnly(allItems, itemsToCount): returns counts for a specific subset of items, given all items and items to count as inputseqArrays(arr1, arr2): compares two arrays and determines if both are equal in size and if all elements matcheqObjects(object1, object2): compares two objects and determins if both are a perfect matchfindKey(object, callback): scans a given object and returns the first key for which the callback returns a truthy value. If no key is found, returns undefinedfindKeyByValue(): scans a given object and returns the first key which contains the given value and if no key is is found (based on given value), then it returns undefinedflatten(array): returns a single-level array, given an array with multiple arrays insidehead(arr1): returns the first element from an arrayletterPositions(sentence): returns indices in the form of an array, indicating where each character is found, all enclosed within an objectmap(array, callback): returns a new array based on restults of the callback functionmiddle(array): returns the middle-most element(s) of a given array (input)tail(arr1): returns every other element within an array, except the first (or head)takeUntil(array, callback): returns a "slice of the array with elements taken fromt the beginning" and continues until callback returns a truthy value. Inputs to the function are an array from which the function collects items and the callback from which the function keep collecting until a truty valuewithout(source, itemsToRemove): returns a subset of a given array, removing unwanted elements