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.
npm install @username/lotide
const _ = require('@username/lotide');
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
head:Returns the first item of an array.
tail:Returns all except the first item of an array.
middle:Returns the middle item/s of an array.
assertArraysEqual:Assert equal function that works for arrays.
assertObjectsEqual:Assert equal function that works for objects.
assertEqual:Assert equal function for primitive data types.
countLetters:Counts the number of characters in a string.
eqArrays:Returns true or false based on whether two arrays are identical.
eqObjects:Returns true or false based on whether two arrays are identical.
findKey:Takes in an object and a callback and returns the first key for which the callback returns a truthy value.
findKeyByValue:Takes in an object and a value, it will scan the object and return the first key which contains the given value.
flatten:Takes in an array that may contain nested arrays and returns an array without nesting.
letterPositions:Take in a string and return an object where the position of each character is stored.
map:Maps the elements from one array to another based on a provided callback function.
takeUntil:Populates a new array with elements from an existing array until a truthy value is returned by the callback function.
without:Takes in two arrays, the elements from the second one are removed from the first, and the resultant array is returned.