1.2.0 • Published 3 years ago
@jpniyitanga/lotide v1.2.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 @jpniyitanga/lotide@1.2.0
Require it:
const _ = require('@jpniyitanga/lotide@1.2.0');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected): compares actual result with expected result (arrays)assertEqual(actual, expected): compares actual result with expected result (primitives)assertObjectsEqual(actual, expected): compares actual result with expected result (objects)eqArrays(array1, array2): compares two arrayseqObjects(obj1, obj2): compares two objectscountLetters(sentence): counts how many times a letter appears in the sentencecountOnly(allItems, itemToCount): counts itemToCount only if they are available in allItemsfindKey(callback): returns a value based on a given keyfindKeyByValue(object): returns a value based on a given keyflatten(array): takes nested arrays and flattened them into one arrayhead(array): returns first element of an arraytail(array): returns other then first element of an arrayletterPositions(array): returns index of each letter in an arraymap(array): returns first letter (at index 0) for each element of an arraymiddle(array): returns middle element or elements of an arrayreverse(string): takes a string from command line arguments and retuns a reversed stringtakeUntil(array, callback): returns a modified array based on the logic of the callbackwithout(source, itemsToRemove): returns source array without itemsToRemove