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 @derekb123/lotide
Require it:
const _ = require('@derekb123/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 array -
tail
: returns everything after the first element of an array -
middle
: returns the middle element of an array if odd, or the two middle elements if equal -
assertEqual
: checks if two values are equal -
assertArraysEqual
: checks if two arrays are equal and returns an empahsized message -
countLetters
: takes a string and returns an object with counts for the number of times each character is used in that string -
countOnly
: takes one array and another array of chosen values, returns an object that counts only the number of times the chosen values are used -
eqArrays
: checks if two arrays are euqal and returns true or false -
eqObjects
: checks if two objects are equal -
findKey
: returns the first key in an object that matches a value parameter -
findKeyByValue
: returns the key that matches a provided value -
flatten
: flattens nested arrays into a single array -
map
: transforms all elements in an array by function parameter -
reverse
: reverses an array -
takeUnitl
: return elements in an array until a passed paramter is met -
without
: return an intial array without the passed items