1.0.1 • Published 3 years ago
@jaxson_baerg/lotide v1.0.1
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 @jaxson_baerg/lotide
Require it:
const _ = require('@jaxson_baerg/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): returns the first element of an arraytail(array): returns everything after the first element of an arraymiddle(array): returns the middle on an arraywithout(array, toRemoveFromArray): returns an array with all elements specified in second parameter removedmap(array, function): returns an array with each element containing the result of the function parameter on initial elementtakeUntil(array, funciton): returns an array containing all elements until element meets function parameter requirementsflatten(array): returns array flattened, all nesting removedletterPositions(string): returns object with each key being a letter and each key's value being the indexes of which it appears in the string parametercountLetters(string): returns an object with each key being a letter and each key's value being the number of times it appears within the string parametercountOnly(array, object): returns an object with each key being the element in the array parameter that matched with a key in the object parameter and each value being the number of times it was counted within the array parameterfindKeys(object, function): returns the first key that passes the requirements of the function parameterfindKeysByValue(object, string): returns the first key of which it's value matches the value parametereqArrays(array, array): returns whether the array parameters are equal or noteqObjects(object, object): returns whether the object parameters are equal or notassertEqual(value, value): logs to the console an assert message whether the primitive value parameters are equalassertArraysEqual(array, array): logs to the console an assert message whether the array parameters are equalassertObjectsEqual(object, object): logs to the console an assert message whether the object parameters are equal