1.0.0 • Published 2 years ago
@cbb89/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 @cbb89/lotide
Require it:
const _ = require('@cbb89/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: takes 2 arrays and returns a deep strict equalsassertEqual
: takes 2 primitives with a strict equalsassertObjectsEqual
: takes 2 objects using strict deep strict equalscountLetters
: takes a string and returns the count of each individual charactercountOnly
: takes in an array of what to count and an object with true or false values for each value that should or shouldn't be countedeqArrays
: takes 2 arrays and does a deep equaleqObjects
: takes 2 objects and does a deep equalfindKey
: takes an object and a callback function uses the callback to return the first keyfindKeyByValue
: takes an object and a value to search for. Returns first equal valuehead
: takes an array and returns first elementletterPositions
: takes a sentence and a letter ('hello').l and returns an array of that letters indicesmap
: takes an array and a callback function that it uses to sort and returns the resultsmiddle
: takes an array and returns the middle element. Returns middle 2 elements if eventail
: takes an array and returns the same array without the headtakeUntil
: takes an array and a callback that determines where to stop in the array. Returns an array up to that pointwithout
: takes 2 arrays. Returns the first array without the elements specified in the second array
1.0.0
2 years ago