@acooper5259/lotide
v1.0.0
Published
my lodash-light personal package
Downloads
9
Maintainers
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 @username/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: returns the fist value of an arraytail(array)
: returns all the remaining values of an array, except the firstmiddle(array)
: returns middle value(s) of the parameter array once sorted.assertArrayEqual(array1, array2
: check for strict equality between arrays, logging out to the consoleassertEqual(actual, expected)
: check for strict equality of an actual and an expected value.assertObjectEqual(object1, object 2)
: check for strict equality between objects, logging out to the console
countLetters(sentence)
: returns an object with individual characters as keys and their count as valuescountOnly(allItems,itemsToCount
: counts through an array for instances of a specific value. Returns an object.eqArrays(array1, array2)
: returns true or false after evaluating for strict equality between 2 arrayseqObject(object1, object2)
: returns true or false after evaluating for equality between 2 objectsfindKey(object, callback)
: returns the key string for an object value determined by the callbackfindKeyByValue(object, value)
: returns the key of an object according to its valueletterPositions(sentence)
: return an object letter/index as key value pairs for a given string.map(array,callback)
: returns a new array after callback applied to initial array.takeUntil(array, callback)
: returns an array of values from initial array until callback evaluates to false.without(source, itemsToRemove)
: returns a shallow copy of an array without the itemsToRemove.