1.0.0 • Published 3 years ago
@mrinal_n/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 @mrinal_n/lotide
Require it:
const _ = require('@mrinal_n/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
.head
: returns first element of array;.tail
: returns the tail of an input array by making a new array;.middle
: returns middle most element(s) in given array;.map
: returns a new array populated with the results of calling a provided function on every element in the calling array;.countOnly
: takes in an array and outputs a count for a specified variable;.without
: returns a subset of a given array, removing unwanted elements;.letterPositions
: returns object with keys holding array of index location of letter occurance;.findKey
: returns the first key in object for which the callback returns a truthy value;.findKeyByValue
: returns key in object based on callback value;.takeUntil
: returns a "slice of the array with elements taken from the beginning"until the callback/predicate returns a truthy value;.eqArrays
: compares two arrays for a perfect match;.assertArraysEqual
: takes in two arrays and console.logs an appropriate message to the console;.assertEqual
: custom assert function also logs a message to console;.eqObjects
: compares two objects for a perfect match;.assertObjectsEqual
: takes in two objects and console.logs an appropriate message to the console;
1.0.0
3 years ago