1.0.1 • Published 3 years ago
@jradigan/lotide v1.0.1
Lotide
Version 1.0.0
The LHL Lotide project is inspired by the Lodash project library, which is a utility library for JavaScript. While Lodash itself is quite powerful, our version of it is simpler in order to focus on learning the fundamentals of programming and data management using JavaScript.
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.
Getting Started
Install it:
npm install @jradigan/lotide
Require it:
const _ = require('@jradigan/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
-
assertEqual(actual, expected)
: compares two values countLeters(strubg)
: counts the number of times each letter appears in the stringcountOnly(allItems, itemsToCount)
: counts only the items specified in theitemsToCount
parametereqArrays(array1, array2)
: compares two arrays to see if equivalent (includes nested arrays)eqObjects(object1, object2)
: compares two objects to see if equivalent (inlcudes nested objects & nested arrays)findKey(object, callback)
: finds the key in the object that is specified in callbackfindKeyByValue(object, value)
: finds the key of the key value pair in the objectflatten(arrays)
: flattens nested arrays into a single arrayhead(input)
: returns the first item in an arrayletterPositions(sentence)
: finds each letter's position in a stringmap(array, callback)
: executes the callback function on the array providedmiddle(list)
: finds the middle item of an arraytail(input)
: outputs all items of an array minus the first item in the input arraytakeUntil(array, callback)
: outputs all items of an array until it comes to the callback item in which it stopswithout(input, remove)
: outputs the input array without the remove item while keeping the initial array in tact