1.0.0 • Published 1 year ago
@spencerhahmo/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 @spencerhahmo/lotide
Require it:
const _ = require('@spencerhahmo/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: asserts if two different arrays equal one anotherassertEqual
: tests whether two values match one anotherassertObjectsEqual
: asserts if two different objects equal one anothercountLetters
: counts each instance of a letter in a stringcountOnly
: takes in a collection of items then returns the count for a specific itemeqArrays
: tests to see if two arrays equal one anothereqObjects
: tests to see if two objects equal one anotherfindKey
: takes in an object and a callback, then scans that object for the first key where the callback returns truthy before returning that. If no truthy value is found, undefined is returned insteadfindKeyByValue
: searches for a key on an object where its value matches a specific valuehead
: gets the first value of an array and tests if it matches a valueletterPositions
: returns the location of each letter in a stringmap
: creates a new array from an existing onemiddle
: returns the middle value(s) of an array based on if the array is an odd or even lengthtail
: gets everything except the first value of an array and tests if it matches a valuetakeUntil
: takes in an array then takes values from the array and pushes them into a new array until a condition is metwithout
: removes values from an array and tests if it equals another
1.0.0
1 year ago