1.0.0 • Published 4 years ago
@hyuntony/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 @hyuntony/lotide
Require it:
const _ = require('@hyuntony/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): returns the first(head) element of the arraytail(array): returns the tail(all elements execept the first) of the arraymiddle(array): returns the middle element(s) of the arrayassertArraysEqual(actual, expected): checks if two arrays are equal and outputs a messageassertEqual(actual, expected): checks if two primitive data are equal and outputs a messageassertObjectsEqual(actual expected): checks if two objects are equal and outputs a messagecountLetters(string): returns a object with count of each charatercountOnly(array, itemsToCount): returns a object with the count of itemseqArrays(actual, expected): returns true if arrays are equaleqObjects(): returns true if objects are equalfindKey(object, callback): returns key for object according to the callback functionfindKeyByValue(object, value): returns key with its value dataflatten(array): returns the array without nested elements in the main arrayletterPositions(string): returns object with key value letter:indexmap(array, callback): returns new array with callback appliedtakeUntil(array, callback): returns reduced array upto the callback valuewithout(array, itemsToRemove): returns reduced array with elements specified removed
1.0.0
4 years ago