@ashleyjn/lotid
v1.0.1
Published
a mock lodash student project
Downloads
10
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 @ashleyjn/lotide
Require it:
const _ = require('@ashleyjn/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: gives you the index[0] element of an arraytail(...)
: gives you all the elements of an array besides index[0]middle(...)
: gives you the middle element of an array, if the array is even it gives you the two middle elements of an arrayassertArraysEqual(...)
: a manual test to see if the expected array is equal to the actual arrayassertEqual(...)
: a manual test to see if the expected value is equal to the actualassertObjectsEqual(...)
: a manual test to see if the expected object is equal to the actual objectcountLetters(...)
: counts how many times a letter appears in a stringeqArrays(...)
: checks if arrays are equaleqObjects(...)
: checks if objects are equalfindKey(...)
: finds if the key is in an objectfindKeyByValue(...)
: finds the key based on the value searchedflatten(...)
: flattens an array so it no longer contains any nested arraysletterPositions(...)
: finds all the letter positions of the value and returns an array of the positionscountOnly(...)
: the function reports back how many instances of each string were found in the allItems array of stringtakeUntil(...)
: returns a new array of all the data that matches the callback functions requirementwithout(...)
: removes specified items from an arraymap(...)
: iterated through an array while applying the function