1.0.2 • Published 4 years ago
@grandmothersill/lotide v1.0.2
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('@grandmothersill/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: asserts whether the inputted arrays are equal or notassertEqual(actual, expected)
: asserts whether actual and expected are equal or notassertObjectsEqual(object1, object2)
: asserts wether the inputted objects are equal or notcountLetters(string)
: returns an object where key-value pairs represent the characters present in the string, and the count of how many times they are included. spaces are excludedcountOnly(array, object)
: returns an object indicating how many times counted values occur in the input arrayeqArrays(array1, array2)
: returns true if arrays are equal, false if they are not equaleqObjects(object1, object2)
: returns true if objects are equal, false if they are not equalfindKey(object, callack)
: returns the first key that meets callback conditionfindKeyByValue(object, soughtValue)
: returns first key whose value equals soughtValueflatten(array)
: returns flatten nested arrays up to one nesting-deephead(array)
: returns the value at array's first indexletterPositions(sentence)
: returns objects indicating the indices of each unique character in a string sentence. spaces are excludedmap(array, callback)
: iterates through array applying callback function to each element, returns array of resultmiddle(array)
: if length of array is odd, returns middle value, if length of array is even, returns middle two values, if array contains 2 or fewer elements, return an empty arraytail(array)
: returns new array containing all but the first value of input arraytakeUntil(array, callback)
: returns values in array up until a value satisfies the callback condition, non-inclusivewithout(array, itemsToRemove)
: return modded array of input array, with items in itemsToRemove removed