1.0.0 • Published 3 years ago
@iourivolkov/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 @iourivolkov/lotide
Require it:
const _ = require('@iourivolkov/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: Takes in two arrays and console.logs an appropriate message to the console based on whether they match.assertEqual
: Compares actual and expected values and prints a message to tell us whether they match.assertObjectsEqual
: Takes in two objects and console.logs and appropriate message to the console based on whether they match.eqArrays
: Takes in two arrays and returns true or false, based on a perfect match.eqObjects
: Compares two objects to tell us whether they match.countLetters
: Takes in a sentence (as a string) and returns a count of each of the letters in that sentence.countOnly
: Takes in a collection of items and returns the counts for a specific subset of those items.findKey
: Takes in an object and a callback, scans the object and returns the first key for which the callback returns a truthy value. If no key is found, it returns undefined.findKeyByValue
: Takes in an object and a value. Scans the object and returns the first key which contains the given value. If no key with that given value is found, it returns undefined.letterPositions
: Returns all the indices (zero-based positions) in a string where each character is found.tail
: Returns the tail (every element except the first element) of an array.takeUntil
: Takes in two parameters and returns a slice of the array with elements taken from the beginning.middle
: Returns the middle element(s) of an array.map
: Creates a new array populated with the results of calling a provided function on every element in the calling array.without
: Returns a subset of a given array, removing unwanted elements.head
: Returns the first element of an array.
1.0.0
3 years ago