1.0.1 • Published 5 years ago
@dimontejulia/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 @dimontejulia/lotide
Require it:
const _ = require('@dimontejulia/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual: Prints if two arrays are equalassertEqual: Prints if two values are equalassertObjectsEqual: Prints if 2 objects are equalcountLetters: Returns an object with the count of each letter.countOnly: Count how many times a value appears in an objecteqArrays: Validates if two arrays are equaleqObjects: Validates if two objects are equalfindKey: takes in an object and a callback and scans the object and returns the first key for which the callback returns a truthy value.findKeyByValue: Returns the key when provided with it's valueflatten: Given an array or an array of arrays, returns all extracted values in 1 arrayhead: returns the head (first element) of an arrayindex: requires all necessary functions and loads them into an objectletterPositions: returns an object with the indexes where each letter shows up in a stringmap: The map function will return a new array based on the results of the callback function.middle: returns the middle element of an array. If there are 2, return both
Testing:
- test files that implement Mocha & Chai to run tests on the above mentioned functions.