1.0.1 • Published 1 year ago
@nourm9/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 @Nourm9/lotide
Require it:
const _ = require('@Nourm9/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
- function : description
assertArraysEqual
: asserts that 2 arrays are equalassertEqual
: asserts that 2 values are equalassertObjectsEqual
: asserts that 2 objects are equalcountLetters
: returns number of letters in a stringcountOnly
: takes values and returns the count for how many times value occurs.eqArrays
: compares if 2 arrays are equaleqObjects
: compares if 2 objects are equalfindKey
: looks through object and returns the first instance for which a callback is truthy.findKeyByValue
: scans through object by key and returns the value that matches given argumentflatten
:flattens nested arrays and returns single array.head
: returns first element of an arrayindex
: includes list of all lotide functions as an object for modular export and import.letterPositions
: function that returns all the indices in the string where each character is foundmap
: makes a new returned array that adds the results of callback function on every elementmiddle
: returns the middle elements of a given arraytail
: returns every element of a given array except the first element of the given arraytakeUntil
: returns elements of an array based on callback argumentwithout
: takes out elements from a given array