@emilywaters/lotide
v1.0.1
Published
Lotide is an equality assertion tool, a simplistic model of Lodash
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 learnings at Lighthouse Labs.
Usage
Install it:
npm install @emilywaters/lotide
Require it:
const _ = require('@emilywaters/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(...)
: Compares arrays and logs the results as pass/failassertEqual(...)
: Strict comparison of primitivesassertObjectsEqual(...)
: Compares objects and logs the result as pass/failcountLetters(...)
: Counts the occurence of letters in a string, and stores the letters with their occurences as key/value pairscountOnly(...)
: countOnly will be given an array and an object. It will return an object containing counts of everything that the input object listed.eqArrays(...)
: compares two arrays for strict equalityeqObjects(...)
: compares two objects for strict equalityfindKey(...)
: finds a specified key in an objectfindKeyByValue(...)
: find key(s) that have a specified valueflatten(...)
: Flattens nested arrays into a single arrayhead(...)
: Grabs the element of an array at index position 0letterPositions(...)
: Maps each letter to a key and stores its index position(s) in an array from a given stringmap(...)
: maps an array into a new arraymiddle(...)
: Grabs the middle element of an array, in the case of even length arrays, grabs the middle two elementstail(...)
: returns an array that is from index position 1 and onwardstakeUntil(...)
: Takes elements of an array up to a position specified by an element valuewithout(...)
: return a subset of a given array, removing unwanted elements