1.0.0 • Published 5 years ago
@jacksonf21/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 @jacksonf21/lotide
Require it:
const _ = require('@jacksonf21/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: returns a more verbose statement of the comparison of array1 and array2assertEqual(value1, value2)
: returns a more verbose statement of the comparison of value1 and value2assertObjectsEqual(obj1, obj2)
: returns a more verbose statement of the comparison of object1 and object2countLetters(string)
: returns an object with key and value pairs counting each lettercountOnly(object1, object2)
: returns an object tallying the values of object1 based on object2's same value as a key with its value=trueeqArrays(array1, array2)
: returns boolean value after comparing array1 and array2eqObjects(object1, object2)
: returns boolean value after comparing object1 and object2findkey(object, function)
: returns key from the object based off the function's logic statementfindKeyByValue(object, value)
: returns key from the object based off the properties valueflatten(array)
: returns an array that flattens one level of array nesting per elementhead(array)
: returns the first element in an arrayletterPositions(string)
: returns an object with key pair values, where values are arrays counting the indexes of each key in the stringmap(array, function)
: returns an array's elements based off the callback functionmiddle(array)
: returns an array with only middle values, one element if odd, two elements if eventail(array)
: returns a new array without the first element of the arraytakeUntil(array, function)
: returns an array with each element until the first match of the callback functionwithout(array1, array2)
: returns an array by taking array1 and including any values that are not within array2
1.0.0
5 years ago