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 @samnarduzzi/lotide
Require it:
const _ = require('@samnarduzzi/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
-
assertArraysEqual: Asserts whether two arrays are equal to one another
-
assertEqual: Asserts whether two values are equal
-
asserObjectEqual: Asserts whether two objects are equal
-
countOnly: Counts the number of occurences of an eleemnt in an array
-
eqArrays: Compares the data of two arrays to see if they are equal to one another
-
eqObjects: Compares the data of two objects to see if they are equal to one another
-
findKey: Function that takes in an object and a callback function, then returns the first callabck that has a truthy value
-
findKeyByValue: Finds the value of a key in an object
-
head: Returns the first item in the array
-
letterPositions: Returns an object with the letters as the keys and has an array of the indexes with the value of that letter
-
map: Takes an array and returns a new array based on the results of the callback function
-
middle: Returns an array with only the middle element or elements of the provided array. Odd arrays will have a single middle element and even arrays will have two middle elements
-
tail: Returns everything except for the first item of the array
-
takeUntil: Returns a truthy value based on a given array and callback funciton which are arguments of the function
-
without: Returns a new array that conatains elements that are in the first array but not in the second array