1.0.0 • Published 2 years ago
@xinyuchen/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 @xinyuchen/lotide
Require it:
const _ = require('@xinyuchen/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: Check if two arrays are equal, show the result on terminal.assertEqual(actual, expected)
: Check if two primitive type elements are equal, show the result on terminal.assertObjectsEqual(object1, object2)
: Check if two objects are equal, show the result on terminal.countOnly(allItems, itemsToCOunt)
: Count the number of an element in allItems based on itemsToCount object.eqArrays(array1, array2)
: Check if two arrays are equal, return boolean values.eqObjects(object1, object2)
: Check if two objects are equal, return boolean values.findKey(object, callback)
: Return the first key that callback(value) returns true, return undefined if no elements match callback requirements.findKeyByValue(object, value)
: Return the first key that has the specific value, return undefined if no elements match the value provided.head(list)
: Return the first element of the array.letterPosition(sentence)
: Return an object containing all letters appeared in the sentence and their indexes in the sentence as values.map(array, callback)
: Apply callback on each element of the array.middle(array)
: Return the median of elements in the array.tail(list)
: Return all elements of the array except the head.takeUntil(array, callback)
: Return all elements before callback evaluates to true.without(source, itemsToRemove)
: Remove itemsToRemove from source.
1.0.0
2 years ago