1.0.0 • Published 6 years ago
@anneloes94/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 @anneloes94/lotide
Require it:
const _ = require('@anneloes94/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2): logs whether two arrays are equalassertEqual(actual, expected): checks two values to see if they are equalassertObjectsEqual(actual, expected): logs whether two objects are equalcountLetters(sentence): creates an objects of letter keys and count values out of a sentencecountOnly(allItems, itemsToCount): filters out items to count out of an array of items and returns an objecteqArrays(arr1, arr2): compares two arrays and sees if they are equaleqObjects(object1, object2): sees whether the keys and values of two objects are the samefindKey(object, callback): returns a key that has to be found in an object, or undefined if it is not presentfindKeyByValue(object, inputValue): returns the first key in an object that matches the inputValue, or returns undefinedflatten(arrayOfArrays): flattens an array input that may exist of multiple arrayshead(array): returns the first (head) element of an arrayletterPositions(sentence): returns an object of indices of letters in a sentencemap(array, callback): modifies an array with a callback function, returns a new arraymiddle(arr): takes the middle element(if length is odd) or elements (if length is even) of an arraytail(array): returns the tail of an array (all but first element)takeUntil(array, callback): returns an array that stops when a callback condition has been metwithout(source, itemsToRemove): returns an array that was filtered from another array
1.0.0
6 years ago