1.0.0 • Published 4 years ago
@kennytse/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 @kennytse/lotide
Require it:
const _ = require('@kennytse/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arrayOne, ArrayTwo)
: asserts that arrayOne is equal to arrayTwoassertEqual(actual, expected)
: asserts if the actual value is the expected valueassertObjectsEqual(actual, expected)
: asserts if the actual object is the expected objectcountLetters(someString)
: counts the amount of times a letter appears in a stringcountOnly(allItems, itemsToCount)
: counts the amount of times a string appears in an array given an object of strings to counteqArrays(arrayOne, ArrayTwo)
: returns true/false based on if the two arrays are the samefindKey(object, cb)
: finds the first key in an object that matches the callback's search specificationsfindKeyByValue(objectToLook, value)
: finds the key that matches the specified valueflatten(arrayToFlatten)
: turns a two dimensional array into a one dimensional arrayhead(array)
: returns the first element in the arrayletterPositions(sentence)
: shows the index of each character's apppearance in a given stringmap(array, callback)
: returns an array based on the callback specificationsmiddle(array)
: returns an array with the middle element(s)reverse(string)
: returns the string in reversetail(array)
: removes the first element in the arraytakeUntil(array, callback)
: returns an array with elements up until a value specified by the callbackwithout(source, itemsToRemove)
: returns the array without the element specified
1.0.0
4 years ago