1.0.0 • Published 2 years ago
@marcogamal/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 @marcogamal/lotide
Require it:
const _ = require('@marcogamal/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: returns the first element of an arraytail
: returns the array without the first elementmiddle
: returns the middle element(s) of the arrayassertArraysEqual
: accepts two arrays and compare them to check if they are equalassertEqual
: accepts two values and compare them to check if they are equalassertObjectsEqual
: accepts two objects as parameters and return true if they are equalcountLetters
: accepts a string and return the occurence of the objectcountOnly
: accepts an array and the parameter, then return the objects in the arrayseqArrays
: returns true if two arrays are equaleqObjects
: returns true if two objects are equalfindKey
: accepts an object and a callbackfindKeyByValue
: accepts object and argument then return the key value and compare if they are equalflatten
: acceptsan array with other arrays inside and return them into a single-level array.letterPositions
: returns a string's index position charactermap
: accepts an array and a callback then return it to modified array with applied callback functiontakeUntil
: return a slice of the array with elements taken from the beginningwithout
: returns a subset of a given array, removing unwanted elements
1.0.0
2 years ago