@genius4hire/lotide
v1.0.2
Published
A mini clone of the Lodash library. This project was created and published by me as part of my learnings at Lighthouse Labs.
Downloads
1
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 cirriculum at Lighthouse Labs.
Usage
Install it:
npm install @genius4hire/lotide
Require it:
const _ = require('@genius4hire/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2)
: compares the contents of arr1 and arr2, and outputs a result to the consoleassertEqual(actual, expected)
: compares two values, and outputs a result to the consoleassertObjectsEqual(actual, expected)
: compares two object, and outputs a result to the consolecountLetters(sentence)
: This function counts the frequency of letters in a string, and returns an object containing a character:count pair for each letter surveyed.countOnly(allItems, itemsToCount)
: return a subset of allItems, removing itemsToCount.eqArrays(arr1, arr2)
: compares the elements of arr1 and arr2, and if they are the same, returns true or false if noteqObjects(object1, object2)
: returns true or false, based on a perfect match of key:value pairs in two objects.findKey(obj, callback)
: returns the first key for which the callback returns a truthy value, or undefined if unsuccessful.findKeyByValue(showsByGenre, nameOfShow)
: scans showsByGenre, and returns an object containing the first key that contains the given valuehead(data)
: returns the first element of an array.letterPositions(sentence)
: returns and object containing all the indices (zero-based positions key pair) in sentence, where a character is foundmap(array, callback)
: returns an array of results from the provided callback that is passed each element in arraymiddle(array)
: return the middle-most element(s) of the given array, either one element for and odd-lengthed array, or two elements for an even lengthed arraytail(data)
: returns an array containing every element from data, except the firsttakeUntil(array, callback)
: returns a subset of array of elements from a provided array until the callback provided returns a truthy value.without(arr1, itemsToRemove)
: returns an array containing a subset of arr1 that does not contain itemsToRemove.