A mini clone of the Lodash library.
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.
Install it:
npm install @wesleymatthee/lotide
Require it:
const _ = require('@wesleymatthee/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
-
head(...)
: Returns the first element in an array -
tail(...)
: Removes the first element in an array -
middle(...)
: 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 empty -
assertArraysEqual(...)
: It checks if two given arrays are equal -
assertEqual(...)
: It checks if two given arguments are equal -
assertObjectsEqual(...)
: 🛑 pending -
countLetters(...)
: It counst the letter in a string -
eqArrays(...)
: It checks if two given arrays are equal -
eqObjects(...)
: It checks if two given objects are equal -
findKey(...)
: It returns the first key for which the callback returns a truthy value. -
findKeyByValue(...)
: It returns the value of the matching key -
flatten(...)
: 🛑 pending -
letterPositions(...)
: It iterates through an object then assigns a key number and an empty array for value if the key is undefined. -
map(...)
: 🛑 pending -
takeUntil(...)
: It iterates through an array and uses a callback to check if a conditon is met. If it is then it returns a new array -
without(...)
: If the index in the array matches the argument it is removed and a new array is made with the remainder.