1.0.0 • Published 5 years ago
@harrishs/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 @harrishs/lotide
Require it:
const _ = require('@harrishs/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2)
: Assert whether two arrays are equalassertEqual(actual, expected)
: Assert whether two values are equalassertObjectsEqual(actual, expected)
: Assert whether two objects are equalcountLetters(items)
: Count number of letters in each instancecountOnly(allItems, items)
: Return count of specified item from a set of itemseqArrays(arr1, arr2)
: Compare 2 arrays and check if equaleqObjects(obj1, obj2)
: Compare 2 objects and check if equalfindKeyByValue(key, val)
: Find key of given valuefindKey(obj, callback)
: Find key where callback function gives truthy valueflatten(arr)
: Remove nesting from arrayshead(arr)
: Returns first value of arrayletterPosition(sentence)
: Return index of of letters in sentencemap(array, callback)
: Put values of array through a callback functionmiddle(arr)
: Returns middle value or middle 2 values if even of an array in an arraytail(arr)
: Return all but first value of arraytakeUntil(arr, callback)
: Return array of items until callback function becomes truewithout(arr, remove)
: Return new array after removing unwanted items from given array
1.0.0
5 years ago