1.0.1 • Published 3 years ago
@eugene-l-h/lotide v1.0.1
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 @eugene-l-h/lotide
Require it:
const _ = require('@eugene-l-h/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head()
: Returns first item from array.tail()
: Returns array minus first item.middle()
: Returns middle item(s) in array.assertArrayEqual()
: Returns a pass/fail message based on the equality of compared arrays.assertEqual()
: Compares two values for equality. Returns true or false.assertObjectsEqual()
: Returns a pass/fail message based on the equality of compared objects.countLetters()
: Counts the amount of times a unique character occurs in a string.countOnly()
: Counts the amount of times a given value occurs in an array.eqArrays()
: Compares two arrays for equality. Returns true or false.eqObjects()
: Compares two objects for equality. Returns true or false.findKey()
: Loops through the key/values of an object and returns that key if it's key and value matches the callback provided.findKeyByValue()
: Returns the first key that matches the inputted value.flatten()
: Empty sub arrays within a given array, keeping the order of indexes intact.letterPositions()
: Takes in a string and returns an object with keys for each unique char and the index positions where those chars can be found.map()
: Loops over an array and calls the callback function provided on each element.