1.0.2 • Published 3 years ago
@nicolelaw/lotide v1.0.2
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 @nicolelaw/lotide
Require it:
const _ = require('@nicolelaw/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(): returns first element of arraytail(): returns all elements of the array except firstmiddle(): returns middle elements of the array, different for under 3 elements, even/oddassertArraysEqual: compares actual and expected values of an array to see if they are the sameassertEqual: compares actual and expected values to see if they are the sameassertObjectsEqual: compares actual and expected values of an object to see if they are the samecountLetters: counts specific letter(s)in a stringcountOnly: counts specific objectseqArrays: compares two arrays to see if they are the sameeqObjects: compares two objects to see if they are the samefindKey: finds the key using an object and a callback functioonfindKeyByValue: scans an object and returns the first key which contains the given valueflatten: flattens nested arrays inside an arrayletterPositions: shows index position of specific lettermap: goes through each element of an array and pulls what you want to produce a new arraytakeUntil: takes a slice of the array from the beginningwithout: filters out unwanted data