1.0.0 • Published 4 years ago
@aelmolla/lotide v1.0.0
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 @aelmolla/lotide
Require it:
const _ = require('@aelmolla/lotide/');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(): Compares two arrays and print out a message alerting us if they are strictly equal or not.assertEqual(): Compares two values and print out a message alerting us if they are strictly equal or not.assertObjectsEqual(): Compares two objects and print out a message alerting us if they are strictly equal or not.countLetters(): Takes in a sentence (as a string) and then returns a count of each of the letters in that sentence.countOnly(): Takes in a collection of items and returns counts for a specific subset of those items.eqArrays(): Compares two arrays and returns true or false, if they are strictly equal or not.eqObject(): Takes in two objects and returns true or false, if they are strictly equal or not.findKey(): Takes in an object and a callback, scans the object and return the first key for which the callback returns a truthy value. If no key is found, it returns undefined.findKeyByValue(): Searches for a key on an object where its value matches a given value.head(): Retrieves the first element from a given array.letterPosition(): Returns all the indices (zero-based positions) in the string where each character is found.map(): Takes in an array and a callback function and returns a new array base on the results of the given callback function.middle(): Takes in an array and returns the middle-most element(s) of a given array.tail(): Retrieves the tail which is every element except the head (first element) of a given array.takeUntil(): Takes in an array and a callback function and returns a slice of the array with elements taken from the beginning until the callback returns a truthy value.without(): Filters out given elements form a given array.
1.0.0
4 years ago