1.0.2 • Published 3 years ago
@zjohansson/lotide v1.0.2
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 @zjohansson/lotide
Require it:
const _ = require('@zjohansson/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(arg): returns the first value of an argumenttail(arg): returns the last value of an argumentmiddle(array): returns middle value of an argument if odd, returns 2 middle values if evenassertArraysEqual(actual, expected): asserts that two arrays are equalassertObjectsEqual(actual, expected): asserts that two objects are equalassertEqual(actual, expected): asserts that two arguments are equalcountLetters(string): scans string and returns count of each letter in stringeqArray(array1, array2): returns boolean if two arrays are equaleqObjects(object1, object2): returns boolean if two objects are equalfindKey(object, callback): scans object and returns the first key that returns a truthy valuefindKeyByValue(allValues, valuetoFind): find the key on an object where it's value matches a given valueletterPositions(string): returns index of each character in a stringmap(array, callback): return new array based on results of callback functiontakeUntil(array, callback): returns a slice of an array with elements taken from the beginningwithout(source, itemstoRemove): filters argument and returns new array without valuecountOnly(allItems, itemsToCount): takes collection of items and return counts for a specific subset of those items