@eruzai/lotide
v1.0.1
Published
A mini clone of the [Lodash](https://lodash.com) library.
Downloads
2
Readme
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 @eruzai/lotide
Require it:
const _ = require('@eruzai/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: returns the head (first element) of an arraytail(...)
: returns the tail (every element following the head) of an arraymiddle(...)
: returns the middle-most element(s) of an arrayassertArraysEqual(...)
: takes two arrays, compares them for equality, and outputs an appropriate message to the consoleassertEqual(...)
: takes two values, compares them for equality, and outputs an appropriate message to the consoleassertObjectsEqual(...)
: returns true if both objects have identical keys with identical valuescountLetters(...)
: return a count of each letter in a given stringcountOnly(...)
: returns an object with counts of all specified items within source object given by array.eqArrays(...)
: takes two arrays and returns true or false, based on a perfect matcheqObjects(...)
: returns true if both objects have identical keys with identical valuesfindKey(...)
: searches an objects keys and performs callback function on each, returns first key that resolves callbackfindKeyByValue(...)
: scans an object to return the first key containing the given valueflatten(...)
: takes an array or nested arrays of elements, and returns a "flattened" version of the arrayletterPositions(...)
: accepts a string and returns an object containing each letter and all of it's index locationsmap(...)
: creates a new array after resolving callback function on each elementtakeUntil(...)
: creates a new array with elements up to the callback resolutionwithout(...)
: return a subset of a given array, removing unwanted elements