1.0.1 • Published 6 years ago
@jusungchai/lotide v1.0.1
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 @jusungchai/lotide
Require it:
const _ = require('@jusungchai/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(a1, a2)
: check if array a1 equals array a2assertEqual(actual, expected)
: check if actual equals expectedassertObjectsEqual(actual, expected)
: check if object 1 equals object 2countLetters(str)
: count non space characterscountOnly(allItems, itemsToCount)
: count items to be counted in an objecteqArrays(a1, a2)
: check if array a1 equals array a2eqObjects(object1, object2)
: check if object1 equals object2findKey(object, callback)
: find key of callbackfindKeyByValue(object, value)
: find key by value in objectflatten(arrOfArr)
: merge nested array into arrayhead(arr)
: find first value in arrayletterPositions(sentence)
: find positions of a letter in sentencemap(array, callback)
: map first letter of word after the word in arraymiddle(arr)
: find middle value of arraytail(arr)
: find last element of arraytakeUntil(array, callback)
: return array of elements from start until value is metwithout(source, itemsToRemove)
: remove all wanted items from source array