1.0.1 • Published 6 years ago
@kvsuen/lotide v1.0.1
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 @kvsuen/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actualArray, expectedArray): assert if two arrays are equalassertEqual(actual, expected): assert if two values of primative type are equalassertObjectsEqual(actualObject, expectedObject): assert if two objects are equalcountLetters(string): count occurence of each lettercountOnly(allItems, itemsToCount): count occurence of specified item that appears in an arrayeqArrays(array1, array2): compare if two arrays are equal, returns a booleaneqObjects(object1, object2): compare if two objects are equal, returns a booleanfindKey(object, callback): find key in objectfindKeyByValue(objectData, valueOfKeyToFind): find key depending on valueflatten(array): turn nested array into single arrayhead(array): return first element of the arraletterPositions(string): return index of all letters in a stringmap(array, callback): perform a callback function for each element in the array, and return a new arraymiddle(array): return middle elements of an arraytail(array): excluding the first element, return the rest of the arraytakeUntil(array, callback): return array up until callback conditionwithout(source, itemsToRemove): return array without the specified items