1.0.0 • Published 3 years ago
@colhyl/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 @colhyl/lotide
Require it:
const _ = require('@colhyl/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(arr): returns first element of an array as an arraytail(arr): returns every element after the head as an arraymiddle(arr): returns the the middle element(s) of an array as an arraymap(arr, callback): performs a function on a given arrayassertArraysEqual(arr1, arr2, expected): test for the equivalence of two arraysassertEqual(actual, expected): test for the equivalence of two data structuresassertObjectsEqual(actual, expected): test for the equivalence of keys, values of two objectscountLetters(str): returns an object of the count of every character in a stringcountOnly(allItems, itemsToCount): returns an object of the count of every element in an arrayeqArrays(arr1, arr2): tests the equivalence of two arrayseqObjects(obj1, obj2): tests the equivalence of two objectsfindKey(obj, callback): performs a callback function on an objectfindKeyByValue(obj, show): returns the key of a value in an objectletterPositions(str): returns the indexes of each character as an objecttakeUntil(array, callback): returns elements of an array up until a given valuewithout(source, itemsToRemove): removes an item from an array
1.0.0
3 years ago