1.0.0 • Published 2 years ago
@iaan_j/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 @iaan_j/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head()
: takes array, returns 0th elementtail()
: takes array, returns 1st, 2nd.... nth elementsmiddle()
: takes array, returns middle element(s) in array, depending if odd/evenassertArraysEqual()
:assertEqual()
: returns assertion statement based on two arguments being equalassertObjectsEqual()
: returns assertion statement based on two input object being equalcountLetters()
: returns object with count of letters from provided stringcountOnly()
: returns object with count of specific input character from input stringeqArrays()
: takes two arrays, returns true if the same or false if noteqObjects()
: takes to input objects and returns true if they are equal, false if not equalfindKey()
: finds first instance of key in an objectfindKeyByValue()
: finds first instance of key in an objectflatten()
: takes nested arrays and returns single (flat) arrayletterPositions()
: takes string and returns object with index locations of each lettermap()
: takes array and inline callback function, and returns new array based on callbacktakeUntil()
: takes array and callback function, returns first slice of array based on callback inputwithout()
: takes source array and array of items to remove; returns new array based on source minus removal
1.0.0
2 years ago