@wesleymatthee/lotide
v1.0.0
Published
LHL lotide
Downloads
1
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 @wesleymatthee/lotide
Require it:
const _ = require('@wesleymatthee/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: Returns the first element in an arraytail(...)
: Removes the first element in an arraymiddle(...)
: Middle returns the two middle elements of an even array and the middle elememt of an odd array. If the array is >3 it returns emptyassertArraysEqual(...)
: It checks if two given arrays are equalassertEqual(...)
: It checks if two given arguments are equalassertObjectsEqual(...)
: 🛑 pendingcountLetters(...)
: It counst the letter in a stringeqArrays(...)
: It checks if two given arrays are equaleqObjects(...)
: It checks if two given objects are equalfindKey(...)
: It returns the first key for which the callback returns a truthy value.findKeyByValue(...)
: It returns the value of the matching keyflatten(...)
: 🛑 pendingletterPositions(...)
: It iterates through an object then assigns a key number and an empty array for value if the key is undefined.map(...)
: 🛑 pendingtakeUntil(...)
: It iterates through an array and uses a callback to check if a conditon is met. If it is then it returns a new arraywithout(...)
: If the index in the array matches the argument it is removed and a new array is made with the remainder.