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 @siningtong/lotide
Require it:
const _ = require('@siningtong/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arrayActual, arrayExpected)
: assert if Arrays are EqualassertEqual(actual,expected)
: assert if items are EqualassertObjectsEqual(actual, expected)
: assert Objects are EqualcountLetters(sentence)
: count letters' frequencycountOnly(allItems, itemsToCount)
: only count certain itemseqArrays(array1, array2)
: compare whether arrays are equaleqObjects(object1, object2)
: compare whether objects are equalfindKey(object,callback)
: find key in an objectfindKeyByValue(object,value)
: find certain Key By Valueflatten(arr)
: Given an array with other arrays inside, it can flatten it into a single-level arrayletterPositions(sentence)
: return all the indices (zero-based positions) in the string where each character is foundhead(array)
: retrieve the first element from the arraymap(array, callback)
: The map function will return a new array based on the results of the callback function.middle(arr)
: This function will take in an array and return the middle-most element(s) of the given array.tail(num)
: This function returns the "tail" of an array: everything except for the first item (head) of the provided array.takeUntil(array, callback)
: The function will return a "slice of the array with elements taken from the beginning."without(source, itemsToRemove)
: This function will return a subset of a given array, removing unwanted elements.