@ajsmartnvm/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 @aj.smartnvm/lotide
Require it:
const _ = require('@aj.smartnvm/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual([array_1], [array_2])
: compares two arrays and return resultsassertEqual(a,b)
: compares two values and return resultsassertObjectsEqual({object_1}, {object_2})
: compares two objectsflattenArray([array])
: takes a nest array and return falt arrayhead([array])
: return first element of an arraymiddle([array])
: returns an array with a single middle element for arrays with odd number of elements. returns an array with two middle_1, middle_2 elements for array with even number of elementstail([array]])
: return last element of an arraycountLetters('string')
: returns an object with letter count for a given stringletterPositions('string')
: return an object with letter position for a given stringmap([array], cbFunction)
: performs a function on each element of array and returns the new arrayfindKey({object}, cbFunction)
: returns object key that matches function callfindKeyByValue({object}, value)
: return object key matching the value
3 years ago