1.0.0 • Published 2 years ago
@handsomepeasant/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 @handsomepeasant/lotide
Require it:
const _ = require('@handsomepeasant/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(): returns the first element of an arraytail(): returns all elements of an array except the firstmiddle(): returns the middle element(s) of an arrayassertEqual(): compares two inputs and prints pass or fail messageassertArraysEqual(): checks if two arrays are identical and prints a pass or fail messageassertObjectsEqual(): checks if two objects are identical and prints pass or faileqArrays(): function used by assertArraysEqual() to check values of arrayseqObjects(): function used by assertObjectsEqual() to check values of objectscountLetters(): returns an object where each key-value pair is a letter that appears in the passed-in string & how many times it appearscountOnly(): receives an array and an object that determines which items in the array will be countedfindKey(): receives an object and a callback value, scans the object and returns the first key for which the callback returns a truthy valuefindKeyByValue(): simplified version of findKey()letterPositions(): returns all indices where each character in a string is foundtakeUntil(): returns items from a passed-in array until the specified callback returns a truthy valuewithout(): takes in two arrays and returns a new array that does not include any items included in itemsToRemove
1.0.0
2 years ago