1.0.1 • Published 4 years ago
@liubovk/lotide v1.0.1
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 @liubovk/lotide
Require it:
const _ = require('@liubovk/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: takes 2 arrays and asserts if they are equalsassertEqual
: takes 2 primitives and asserts if they are equalassertObjectsEqual
: takes 2 objects and asserts if they are equalcountLetters
: takes string and count number of letterscountOnly
: takes arrays of items and array of items to count and return objet with items and frequencyeqArrays
: compare if arrays are equaleqObjects
: compare if objects are equalfindKey
: return key according to cd fnfindKeyByValue
: return key by valueflatten
: return flat array from nested arrayshead
: return 1st element of arrayletterPosition
: return object with letters as keys and arrays of their positions as valuefindKeyByValue
: return key by valuemap
: takes an array and transform each element according to cb fnmiddle
: return element or array of two elements in the middle of the given arraytail
: return array without the first elementtakeUntil
: return an array of elements of given array until the cb function returns truewithout
: remove unwanted element from the array