1.0.0 • Published 2 years ago
@bsaldanha/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 @bsaldanha/lotide
Require it:
const _ = require('@bsaldanha/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): Gives you the first element of an arraytail(array): Gives you the the tail of an arraymiddle(array): Gives you the middle of an arraycountOnly(allItems, itemsToCount): counts the occurences of itemsToCount in allItemscountLetters(sentence): counts letters in a sentencefindKey(obj,callback): finds a key with a callback functionfindKeyByValue(obj, val): finds a key by value,flatten(array): flattens a nested array,letterPositions(sentence): returns the position of an alphabet in a sentence,map(array, callback): iterates over array and performs the callback function,takeUntil(array, callback): returns a new array with items from given array until the callback specifieswithout(array, itemsToRemove): return a new array without itemsToRemoveassertEqual(actual, expected): checks if 2 variables are equal, and prints out pass or failassertArraysEqual(firstArray, secondArray): checks if 2 arrays are equal, and prints out pass or fail,eqObjects(object1, object2): checks if 2 objects are equalassertObjectsEqual(actual, expected): checks if actual is the same as equal, and prints out pass or fail,eqArrays(first, second): checks if 2 arrays are equal,
1.0.0
2 years ago