1.0.0 • Published 5 years ago
@jerkfree/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 @jerkfree/lotide
Require it:
const _ = require('@jerkfree/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: finds the first element in arraytail
: takes out first element in array, returns restmiddle
: finds the middle elements in the arrayassertArraysEqual
: checks if two arrays are equalassertEqual
: checks if two items are equaleqArrays
: checks if two arrays are equal, and them compare if true or falseassertObjectsEqual
: checks if two objects are equal, if so return true or falsecountLetters
: count how many letters in array and return in object formatcountOnly
: count the items you want to count, return in objecteqObjects
: checks if two objects are equalfindKey
: finds the value of the key, and then return the key name once condition is met (i.e. find first value with 2 stars)findKeyByValue
: find the key by the values in keyflatten
: flattens nested arrays, and pushes them out so it'll show as all elements in individual arrayletterPositions
: count the values of letters in a string, and return as key value object formatmap
: goes through each item of array, and does something to it based on the callback function/argument implementedreverse
: reverse the itemtakeUntil
: loops through array, and stops until it hits the condition that is searched forwithout
: goes through two arrays, and displays the items that are different from both
1.0.0
5 years ago