1.0.0 • Published 2 years ago
@lucusr/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 @username/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: Asserts whether or not two arrays are equal.assertEqual
: Asserts whether or not two values are equal.assertObjectsEqual
: Asserts whether or not two objects are equal.countLetters
: Returns a count of each letter in a string.countOnly
: Returns an object containing counts of everything an input object listed from a given array and object.eqArrays
: Loops through two arrays to see if they are equal.eqObjects
: Loops through two objects to see if they are equal.findKey
: Scans an object and returns the first key which returns a truthy value for a provided callback function. Returns undefined if no key is found.findKeyByValue
: Scans an object and returns the first key which contains a given value.head
: Returns the first item in an array.letterPositions
: Returns all indices in a given string.map
: Returns a new array from a callback function.middle
: Returns the middle item in an array.tail
: Returns an array with the first item.takeUntil
: Returns a slice of an array starting from the first index until a callback returns a truthy value.without
: Returns a subset of an array without specified elements.
1.0.0
2 years ago