1.0.0 • Published 3 years ago
@eileenxue/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 @eileenxue/lotide
Require it:
const _ = require('@eileenxue/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: Assert that two arrays are equalassertEqual(actual, expected)
: Assert that two arguments are equalassertObjectsEqual(object1, object2)
: Assert that two objects are equalcountLetters(inputText)
: Count the number of times a letter appears in a string without the white spacescountOnly(allItems, itemsToCount)
: Count if the element is part of an array based on a list of items in an object with boolean valueseqArrays(array1, array2)
: Check if two arrays are the sameeqObjects(object1, object2)
: Check if two objects are the samefindKey(objects, callback)
: Return the first key that matches the value in the callback's object's key's valuefindKeyByValue(object, value)
: Return the key that matches the object's valuehead(array)
: Return the first element in an arrayletterPositions(string)
: Return the index position of the letters in a string in an object formatmap(array, callback)
: Return the result based on the index value of the callback functionmiddle(array)
: Return the middle elements of on array (one element for odd, two elements for even number array lengths)tail(array)
: Return the remaining array elements omitting the first elementtakeUntil(array, callback)
: Return the array elements up to a value set in the callback functionwithout(source, itemsToRemove)
: Return a subset of a given array, removing unwanted elements
1.0.0
3 years ago