1.0.2 • Published 2 years ago
@megantherion/lotide_megantherion v1.0.2
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 @megantherion/lotide
Require it:
const _ = require('@megantherion/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
*head, tail, middle, countLetters, countOnly, findKey, findKeyByValue, letterPositions, map, takeUntil, without
head()
: retrieves the head of an arraytail()
: retrieves the tail of an arraymiddle()
: retrieves the middle-most element/s of an arrayassertArraysEqual()
: asserts if two arrays are equalassertEqual()
: asserts if two primitive values are equalassertObjectsEqual()
: asserts if two objects are equalcountLetters()
: counts the occurrence of each letter in a string of letterscountOnly()
: counts the occurrence of a character in a stringeqArrays()
: compares two arrays for equalityeqObjects()
: compares two objects for equalityfindKey()
: retrieves a specified key from an objectfindKeyByValue()
: finds a key based on a valueletterPositions()
: finds the position of a letter in a stringmap()
: iterates over an array and performs a callback functiontakeUntil()
: retrieves items from an array until a specified itemwithout()
: creates a new array of items without specified items from original array