1.0.0 • Published 1 year ago
@carmshito/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 @carmshito/lotide
Require it:
const _ = require('@carmshito/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(...)
: asserts that two values are equalassertArraysEqual(...)
: asserts that two arrays are equalassertObjectsEqual(...)
: asserts that two objects are equaleqArrays(...)
: compares if two arrays are equaleqObjects(...)
: compares if two objects are equalhead(...)
: returns the first element of an arraymap(...)
: creates a new array populated with the results of calling a function on every element of the arraytail(...)
: returns the every element of an array except for the first elementmiddle(...)
: returns the middle element of an arrayfindKey(...)
: scans the object and returns the first key for which the callback function returns a truthy valuefindKeyByValue(...)
: scans the object and returns the first key which contains the given valuecountOnly(...)
: function that takes items and returns counts for a specific subset of those itemscountLetters(...)
: function that returns counts of each letter of a stringletterPositions(...)
: function that returns all the indices in the strings where each character is foundwithout(...)
: removes elements from an arraytakeUntil(...)
: returns a slice of the array from the original array until the callback provide returns a truthy valueflatten(...)
: function that takes an array containing elements including nested arrays of elements and returns a flattened version of the array
1.0.0
1 year ago