@stan-sk/lotide
v1.0.0
Published
Mini clone of lotash library
Downloads
2
Readme
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 @stan-sk/lotide
Require it:
const _ = require('@stan-sk/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: Returns thefirst element
of an arraytail(array)
: Returns an array without thefirst element
middle(array)
: Returns themiddle one
ormiddle two
element(s) depends if an array length is odd or evenwithout(array)
: Returns a new array with items that wants to keeptakeUntil(array)
: Continue to return array's items to a new array until hitting a specific itemmap(array, callback)
: creates a new array populated with the results of calling a provided function on every element in the calling array.letterPositions(string)
: put in a string, return as an object showing the index of eaah characterfindKey(object, callback)
: putting in an object and a callback function, and returning the keyfindKeyByValue(object, value)
: putting in object and value, returningcountLetters(string)
: count the occuring frequency of each character in a string, not counting the spacecountOnly(array, object)
: putting in an array, and object with a boolean value, outputting an object key that is true.eqArrays(...)
: check if two arrays are equaleqObjects(...)
: check if two objects are equalassertArraysEqual(...)
: check if the assertion of arrays passing or not.assertEqual(...)
: check if expected result and actual result are equalassertObjectsEqual(...)
: check if the assertion of object passing or not.