1.0.0 • Published 2 years ago
@saadsidd/lotide v1.0.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 @saadsidd/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: log pass/fail to console whether two arrays are equalassertEqual(actual, expected)
: log pass/fail to console whether two primitives are equalassertObjectsEqual(actual, expected)
: log pass/fail whether two objects (primitives & arrays only) are equalcountLetters(string)
: return object with count of all letters in stringcountOnly(allItems, itemsToCount)
: return count of matching strings from array of stringseqArrays(array1, array2)
: return true/false whether two arrays are equaleqObjects(object1, object2)
: return true/false whether two objects (primitives & arrays only) are equalfindKey(object, callback)
: return key from object that matches callback conditionfindKeyByValue(object, value)
: return key of object by given valueflatten(array)
: return new 1D array from nested 2D arrayshead(array)
: return first element of arrayletterPositions(string)
: return object with positions for all characters in stringmap(array, callback)
: return new array after callback function called on all elements of given arraymiddle(array)
: return middle element of array (or 2 elements if array length is even)tail(array)
: return array from 2nd element onwardtakeUntil(array, callback)
: return new array from given array start until callback returns truewithout(array, itemsToRemove)
: return new array with items from given array that are not also in itemsToRemove
1.0.0
2 years ago