1.0.1 • Published 2 years ago
@bulabd/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 @bulabd/lotide
Require it:
const _ = require('@bulabd/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: returns the head of an arraytail(array)
: returns the tail of an arraymiddle(array))
: returns the body of an arrayassertArraysEqual(actual, expected)
: asserts if actual array is equal to expectedassertEqual(actual, expected)
: asserts if actual value is equal to expected valueassertObjectsequal(actual, expected)
: asserts if actual object is equal to expected objectcountLetters(str)
: returns the amount of letters in a stringcountOnly()
: descriptioneqArrays(array1, array2)
: returns true if actual array is equal to expected array and false if noteqObjects(object1, object2)
: returns true if actual object is equal to expected object and false if notfindKey(obj, callback)
: returns the first key that matches the callback requirementsfindKeyByValue(obj, value)
: returns the key whose value matches the value argumentflatten(array)
: returns an array with all the internal arrays flatten outletterPositions(str)
: returns an object of all the letters in the string and their positions as an arraymap(array, callback)
: returns the array but with the callback applied on ittakeUntil(array, callback)
: returns the array up until the callback condition is metwithout(array, erase)
: returns array with the erase argument deleted from it