1.0.4 • Published 7 months ago
@nahcg/lotide v1.0.4
Lotide
A mini clone of the Lodash library.
Published on NPM (https://www.npmjs.com/package/@nahcg/lotide)
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 @nahcg/lotide
Require it:
Type node
into terminal to launch REPL\
const _ = require('@nahcg/lotide');
Call it:
_.tail([1, 2, 3]) // => [2, 3]
\
_.middle([1, 2, 3, 4, 5, 6, 7]) // => [4]
Documentation
The following functions are currently implemented:
assertArraysEqual
: asserts if two arrays are equalassertEqual
: asserts if two variables are equalassertObjectsEqual
: asserts if two objects are equalcountLetters
: returns frequency count of each letter in a stringcountOnly
: For a list of names, returns frequency count of names that appear in a second list of names that should be countedeqArrays
: comapares if two arrays are equaleqObjects
: compares if two objects are equalfindKey
: given a callback, finds key of object whose value is a nested objectfindKeyByValue
: given a value, find keyflatten
: returns single dimension array given a multi-level nested arrayhead
: returns first variable in an arrayletterPositions
: returns index of each letter in a stringmap
: applies same callback function to each variable of an arraymiddle
: returns middle variable of an array if odd, returns middle two variables of an array if eventail
: returns given array without the first variabletakeUntil
: returns the beginning of an array until a given value is foundwithout
: given two arrays, returns values of first array that are not present in the second array