@timjquigg/lotide
v1.0.1
Published
practice module for Lighthouse Labs web development bootcamp. imitation of the lodash library
Downloads
5
Readme
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 @timjquigg/lotide
Require it:
const _ = require('@timjquigg/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: Compares 2 arrays and confirms if they are deeply equalassertEqual(actual, expected)
: Compares 2 primitive values and confirms if they are equalassertObjectsEqual(actual, expected)
: Compares 2 objects and confirms if they are deeply equalcountLetters(str)
: Accepts a string input and produces an object with the total occurances of each letter in the stringcountOnly(allItems, itemsToCount)
: Accepts an array of values and produces an object with the total occurances of items that appear initemsToCount
eqArrays(arrOne, arrTwo)
: Accepts two arrays and does a deep equals comparisoneqObjects(object1, object2)
: Accepts two objects and does a deep equals comparisonfindKey(obj, callback)
: Returns the key of an object who's value meets the criteria provided in the callback functionfindKeyByValue(obj, targetValue)
: Returns the key of an object who's value is the target valueflatten(arr)
: Accepts a nested array and returns of flattened arrayhead(input)
: Accepts and array and returns the first element of the arrayletterPositions(sentence)
: Accepts a string and returns an object with each letter in the string as keys and values being arrays of the index of each occurance of the lettermap(arr, callback)
: is an implimentation of the built-in Array.Prototype.map() functionmiddle(arr)
: Accepts an array as input and returns the middle element(s)tail(input)
: Accepts an array as input and returns a new array with the first element removedtakeUntil(array, callback)
: Accepts an array as input and returns a new array containing all of the elements up until the conditions of the callback function are metwithout(source, itemsToRemove)
: Accepts an array as input and returns a new copy with the items initemsToRemove
removed