2.0.0 • Published 4 years ago
@zanthbr/lotide v2.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 @zanthbr/lotide
Require it:
const _ = require('@zanthbr/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
tail(array)
: returns the tail or all but first index values of an arrayhead(array)
: returns only the head or 0 index value of an arraymiddle(array)
: returns the middle index value or middle middle two index values if an array is equalassertArrayEquals(array1, array2)
: Prints whether the two arryas passed are shallowEqual to each other.assertEqual(primitive1, primitive2)
: Returns whether the two inputted primitive values are equals to one anotherletterPositions(string)
: returns an object containing the index values of the positions of the various characters in the stringmap(array, callback)
: returns all elements of the inputted array for which callback evaluates to truetakeUntil(array, callback)
: returns the values of the array until the the callback evaluates to trueflatten(array)
: returns an array with the all arrays one level deeper removed and their values placed into the inputted arraywithout(array, arrayOfItemstoRemove )
: returns the array without any elements identical to elements in the seconds arrayeqObjects
: should return a boolean statement after it checks both objects values and compare the two objects to see if they're equal"countLetters
: should return a number after it counts the number of characters in the stringcountOnly
: should return an object with the names desired as the value and a count number value of how many time the name occuredassertObjectEqual
: should return an assert statement if true or falsefindKey
: should return the key of the first value that satisfies the condition givenfindKeyByValue
: should return the key of the value given
2.0.0
4 years ago