1.0.0 • Published 4 years ago
@faridamus/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 @faridamoussaeff/lotide
Require it:
const _ = require('@faridamoussaeff/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...):returns the first element in an arraytail(...): returns all elements in an array except for the first elementmiddle(...): finds and returns the middle value or values of an arraywithout(...): takes in a source and items to remove and returns the source with specified items removedtakeUntil(...): takes in an array and loops through it until a specified condition is metmap(...): makes a copy of an existing arrayletterPositions(...): takes in a string and returns all the indices in the string where each character is foundfindKey(...): scans an object and returns the first key for which the callback returns a truthy value.findKeyByValue(...): returns a key from an object when provided with a value as an argumenteqObjects(...): compares two objects to check for a matcheqArrays(...): compares two arrays to check for a matchcountOnly(...): return counts for a specific subset of those itemscountLetters(...): counts the number of letters in a stringassertEqual(...): compares strings and numbers and asserts whether they are equalassertArraysEqual(...): assertion test to determine whether two arrays are equalassertObjectsEqual(...): assertion test to determine whether two objects are equal
1.0.0
4 years ago