@joezhu/lotide
v1.0.0
Published
a mini clone for Lodash done in Lighthouse Labs
Downloads
6
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 @joezhu/lotide
Require it:
const _ = require('@joezhu/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: take the first element of an arraytail(array)
: take all the elements expect for the first one in an arraymiddle(array)
: return middle section of an array;assertArraysEqual(array1, array2)
: assert true if two arrays are equal else falsassertEqual(actual, expected)
: check to see if the actual results match the expectsassertObjectsEqual(object1, object2)
: make assertion about if two objects are equalcountLetters(string)
: count the amount of letters in a certain stringcountOnly(allItems, itemsToCount)
: count how many times itemsToCount appears in allItemseqArrays(array1, array2)
: to compare two arrays to see if equaleqObjects(object1, object2)
: to compare two objects to seee if equalfindKey(object, callback)
: to find a certain key in an objectfindKeyValue(value)
: find a certain value in an ojbectflatten(array)
: turn an nested array to a non-nested arrayletterPositions(string)
: return each letter's positions in a stringmap(array, callback)
: return a new array from the input array according to the callback functiontakeUntil(array, callback)
: return a new array through the return of the callbackwithout(array1, array2)
: remove array2 from array1