1.0.0 • Published 4 years ago
@amalhussn/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 @amalhussn/lotide
Require it:
const _ = require('@amalhussn/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: Asserts that two arrays are equal.assertEqual
: Compares two values it takes in and prints out a message telling us if they match or not.countLetters
: Returns a count of each of the letters in the sentence.countOnly
: This function should takes in a collection of items (in this case, Strings) and return counts for a specific subset of those items.eqArrays
: Takes in two arrays and returns true or false, based on a perfect match.eqObjects
: Takes in two objects and returns true or false, based on a perfect match.findKey
: Returns the first key for which the callback returns a truthy value. If no key is found, then it returns undefined.findKeyByValue
: Returns the first key which contains the given value. If no key with that given value is found, then it should return undefined.head
: Retrieves the first element from the arrayletterPositions
: Returns all the indices in the string where each character is found.map
: Returns a new array based on the results of the callback function.middle
: Returns the middle-most element(s) of the given array.tail
: Retrieves (the tail) every element except the head (first element) of the array.takeUntil
: Returns a "slice of the array with elements taken from the beginning." It will keep collecting items from a provided array until the callback provided returns a truthy value.without
: Returns a subset of a given array, removing unwanted elements.
1.0.0
4 years ago