1.0.0 • Published 2 years ago
@teknoboten/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 @teknoboten/lotide
Require it:
const _ = require('@teknoboten/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: return the first element of an arraytail(...)
: return everything but the head of an arraymiddle(...)
: return the middle element(s) of an arrayassertArraysEqual(...)
: check for equality between two arrays and log result to consoleassertEqual(...)
: check for equality between two values and log result to consoleeqArrays(...)
: checks for equality between two arrays and returns true / falsecountLetters(...)
: counts how many times every letter in a string occurscountOnly(...)
: counts only the desired elements in an arrayassertObjectsEqual(...)
: check for equality between two objects and log result to consolefindKey(...)
: find and return the key of a given value within an objectfindKeyByValue(...)
: find and return the value of a given key within an objectflatten(...)
: flatten two dimensional arrays (more dimensions pending)letterPositions(...)
: counts at which indexes letters occur within a given string and returns an objectmap(...)
: performs a given callback on every element in a array and returns a new arraytakeUntil(...)
: pushes every element in an array to a new array until the given callback returns turnwithout(...)
: filters items in a given array1 from array2 and returns a new arrayeqObjects(...)
: checks for equality between two arrays and returns true / false
1.0.0
2 years ago