1.0.0 • Published 2 years ago
@melonaster/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 @melonaster/lotide
Require it:
const _ = require('@melonaster/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: Assertion of two arrays to see if they are equal or notassertEqual(actual, expected)
: Assertion of two values to see if they are equal or notassertObjectsEqual(object1, object2)
: Assertion of two objects to see if they are equal or notcountLetters(string)
: Input of a string to find how many letters there arecountOnly (allItems, itemsToCount)
: Input of an array and a item to count, returns how many times the item was countedeqArrays (array1, array2)
: Compares two arrays to see if they are equal or noteqObjects (object1, object2)
: Compares two objects to see if they are equal or notfindKey (object, callback)
: Takes in an object and a callback to find its key.findKeyByValue (guide, want)
: Takes in an object and a value to find its key.flatten (array)
: Takes in an array and gets rid of all the nested array to return one arrayhead (array)
: Takes in an array to return the first elementletterPositions (sentence)
: Takes in a sentence of string and returns the letter positions in an arraymap (array, callback)
: Takes in an array to map and a call back function. It will return a new array based on the results of the call back functionmiddle (array)
: Takes in an array and returns the middle valuetail (array)
: Takes in an array and returns all the values after the first valuetakeUntil (array, callback)
: Takes an array and a callback value. Will return an array of values before the callbackwithout (source, itemsToRemove)
: Takes in a source array and returns the array with the itemsToRemove values removed.
1.0.0
2 years ago