1.0.0 • Published 5 years ago
@christophertoy/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 @christophertoy/lotide
Require it:
const _ = require('@christophertoy/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual...): compares 2 arrays and prints out a message tellin us if they matchassertEqual(...): compares the 2 values it takes in and prints out a message telling us if they matchassertObjectsEqual(...): compares 2 objects and prints out a message tellus us if they matchcountLetters(...): takes a string and outputs an object with counts of each lettercountOnly(...): takes an array and an object and will return an object with counts of everything the object listedeqArrays(...): compares 2 arrays and returns true or false, depending on the matcheqObjects(...): takes 2 objects and returns true or false, depending on the matchfindKey(...): takes an object and call back, scans the object and returns the first key for which the callback returns a truthy valuefindKeyByValue(...): takes in an object and value, returns first key given the valuehead(...): retrives the first element from the arrayletterPositions(...): takes a string and will return all the indices where each letter is foundmap(...): creates new array with the results of calling a provided function on each elementmiddle(...): takes an array and returns the middle elementstail(...): returns the all the elements of the array except for the first elementtakeUntil(...): return a slice of the array of elements until the callback returns truewithout(...): compares 2 arrays and filters unwanted items
1.0.0
5 years ago