1.0.0 • Published 2 years ago
@steponitjenn/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 @steponitjenn/lotide
Require it:
const _ = require('@steponitjenn/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: retrieves the first element from the arraytail(...)
: tail retrieves every element except the head of the arraymiddle(...)
: returns the middle elements in an arraywithout(...)
: returns an array without a specified elementassertArraysEqual(...)
: asserts two arrays are equalassertObjectsEqual(...)
: asserts two objects are equaleqArrays(...)
: compares two arrays for a perfect matchassertEqual(...)
: compares two values and prints a message telling us if they match or nottakeUntil(...)
: returns a slice of the array with elements taken from the beginningmap(...)
: returns a new array based on the results of the callback functionletterPositions(...)
: takes in a string and return all the indices where each character is foundflatten(...)
: flattens a double-layer nested array into a single-layer nested arrayfindKeyByValue(...)
: searches for a key in an object where its value matches a given valuefindKey(...)
: return the first key for which the callback returns a truthy valueeqObjects(...)
: compares two objects for a perfect matchcountOnly(...)
: takes in a collection of items and return counts for a specific subset of those itemscountLetters(...)
: takes in a string and returns a count of each of the letters
1.0.0
2 years ago