1.0.0 • Published 5 years ago
@ktobar/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 @ktobar/lotide
Require it:
const _ = require('ktobar/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): Retrieve the first element of arraytail(array): Retrieve all but the first element of arraymiddle(array): Retrieve the middle elements of array that is 3 or greaterassertArraysEqual(actualArr, expectedArr): Arrays compare and success / failure messages printed to consoleassertEqual(actualVal, expectedVal): Values compare and success / failure messages printed to consoleassertObjectsEqual(actualObj, expectedObj): Object compare and success / failure messages printed to consolecounterLetter(string): Retrieve counts for character in stringcountOnly(allItems, itemsToCount): Retrieve count for a specific valueeqArrays(actualArr,expectedArr): Compare two arrays for a equal matcheqObjects(actualObj,expectedObj): Compare two objects for a equal matchfindkey(object, callback): Search for a key in object for value matching a given valuefindKeyByValue(obj,key): Searche an object and return the first key matching callbackletterPositions(string): Return all the indices (zero-based positions) in the string where each character is foundmap(array, callback): Retrieve a new array based on the results of the callback functiontakeUntil(array, callback): Retrive a slice of the array with elements taken from the beginningwithout(array1,array2): Retrive a subset of a given array, removing unwanted elements
1.0.0
5 years ago