1.0.0 • Published 3 years ago
@rdmptn/lotide2 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 @rdmptn/lotide
Require it:
const _ = require('@rdmptn/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2)
: Tests array equalityassertEqual(actual, expected)
: Tests statement equalityassertObjectsEqual(actual, expected)
: Tests object equalitycountLetters(string)
: Returns number of occurences of each letter in a stringcountOnly(allItems, itemsToCount)
: Counts the number of itemsToCount in the object allItemseqArrays(arr1, arr2)
: Compares array equalityeqObjects(object1, object2)
: Compares object equalityfindKey(object, callback)
: Returns the key with value that meets the callback function criteriafindKeyByValue(obj, value)
: Returns the key with the specified valueflatten(array)
: Returns nested arrays as one single arrayhead(arr)
: Returns first element in an arrayletterPositions(sentence)
: Returns an object containing arrays of the positions of each letter in a sentencemap(array, callback)
: Returns an array containg elements of the original array that are filtered for some criteria in the callbackmiddle(arr)
: Returns the middle element(s) in an arraytakeUntil(array, callback)
: Returns an array of all elements from the original array until the specified criteria is mettail(arr)
: Returns all but the first element in an arraywithout(source, itemsToRemove)
: Returns an array of all the items that don't match the criteria in itemsToRemove
1.0.0
3 years ago