1.0.1 • Published 4 years ago
@joe123123/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 @joe123123/lotide
Require it:
const _ = require('@joe123123/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array, array)
: Asserts two arrays are equal and provides feedback in consoleassertEqual(actual, expected)
: Asserts two values are equal and provides feedback in consolecountLetters(string)
: Counts the number of letters in a stringcountOnly(allItems, itemToFind)
: Counts the occurence of specified itemeqArrays(array1, array2)
: Compare two arrays and returns true or falseeqObjects(object1, object2)
: Compare two objects and returns true and falsefindKey(objects, callback)
: Scans the object and return the first key for which the callback returns a truthy valuefindKeyByValue(object, value)
: Scans object and looks for the key name based on the valueflatten(array)
: Flattens array a single level deepflattenDeep(array)
: Recursively flattens arrayhead(array)
: Returns the first item of an arrayletterPositions(string)
: Returns all the indices in the string where each character is foundmap(array, callback)
: Performs a callback function on each element of an arraymiddle(array)
: Returns a middle item of the arraytail(array)
: Returns all items after the firsttakeUntil(array, callback)
: Returns a slice of the array with elements from the beginning until the callback returns falsewithout(source, toRemove)
: Removes items from an array that toRemove includes