1.0.1 • Published 4 years ago
@seamusmcgill/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 @seamusmcgill/lotide
Require it:
const _ = require('@seamusmcgill/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function1(...): descriptionfunction2(...): descriptionfunction3(...): descriptionhead(array): Return the head element of an arraytail(array): Return the tail elements of an arraymiddle(array): Return the middle elements of an arrayassertEqual(actual, expected): Print assertion of equality between primitive valuesassertArraysEqual(actual, expected): Print assertion of equality between two arraysassertObjectsEqual(actual, expected): Print assertion of equality between two objectscountLetters(sentence): Return an object with the letter counts for each letter in a sentencecountOnly(allItems, itemsToCount): Given an array of items (allItems), count the number of instances of values that have a "true" value in the itemsToCount objecteqArrays(array1, array2): Return true if two arrays are deeply equaleqObjects(object1, object2): Return true if two objects are deeply equalfindKey(object, callback): Return key from object whose value satisfies given callback conditionfindKeyByValue(object, value): Return key from object whose value is equal to input valueflatten(array): Flatten an array with elements that are nested arrays. Only handles one level of nesting.letterPositions(sentence): Return an object with the indices of each ocurrence of letters in a sentencemap(array, callback): Return a new array containing the elements of the input array as transformed by the callback functiontakeUntil(array, callback): Return an array that contains the elements up until the element in the input array that satisfied the callback conditionwithout(source, itemsToRemove): Return a subset of a given array, removing unwanted elements