1.0.1 • Published 4 years ago
@bunge12/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 @bunge12/lotide
Require it:
const _ = require('@bunge12/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array, array)
: Compares two arrays and returns true or falseassertEqual(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 arrayseqObjects(object1, object2)
: Compare two objectsfindKey(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 an array of arrays into a single level 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 taken from the beginningwithout(source, toRemove)
: Removes items from an array and returns a new array