1.0.0 • Published 2 years ago
@joshuavottero/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 @joshuavottero/lotide
Require it:
const _ = require('@joshuavottero/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(expected, realty)
: prints true if value 1 === value 2assertArraysEqual(expected[], realty[])
: prints true if both arrays are the sameassertObjectEqual(expected{}, reality{})
: prints true if both objects are the sameeqArray(array1, array2)
: returns true if both arrays are the sameeqObject(object1, object2)
: returns true if both objects are the samehead(array)
: returns the frist element of a array if anymiddle(array)
: returns the middle element(s) length must be at least 3 and will return 2 elements if length is a even number like 2 or 4tail(array)
: returns all elements but not the frist onecountLetters(array)
: returns the number of letters in a stringcountOnly(array, value)
returns the number of a value in a arrayfindKey(object, callback)
: returns the first key to match a value useing a callback functionfindKey(object, value)
: returns the first key to match a valueletterPositions(array, letter)
: returns a array with the index value of al elements with lettertakeUntill(array, callBack)
: returns all array elements till callBack returns truewithout(array, remove)
: returns array with all remove value elements removed
1.0.0
2 years ago