1.0.0 • Published 8 months ago
@dechantg/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 @dechantg/lotide
Require it:
const _ = require('@dechantg/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: compares two arraysassertEqual(actual, expected)
: compares two stringsassertObjectsEqual(actual, expected)
: compares two objectscountLetters(string)
: counts the letters in a stringcountOnly(allItems, itemsToCount)
: takes in an array and counts the number of occurances of each letter (ignores spaces)eqArrays(actual, expected)
: comapres two arrayseqObjusts(actual, expected)
: comapres two objects. including if values are in an arrayfindKey(object, callback)
: searches an object for first match of the callback and returns the keyfindKeyByValue(object, value)
: searchs an object for a key based on valuehead(array)
: returns 0 index of an arraytail(array)
: removes 0 index and returns the tail of an arraymiddle(arrauy
: searches and array for the middle value. if array size is even returns the two middle valuesletterPositions(sentence)
: returns an object with the letters in a string and their respective positions in the string (ignores spaces)map(array, callback)
: takes in an array and returns modifications based on callbacktakeUntil(array, callback)
: takes in an array and returns untill the function reaches the callbackwithout(array, value)
: takes in an array and removes the value
1.0.0
8 months ago