@jeffreyleec/lotide
v1.0.1
Published
student of Lighthouse Labs (Jeffrey Lee)'s first json package. Includes useful functions. Please see readme file for more info
Downloads
4
Readme
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 @jeffreyleec/lotide
Require it:
const _ = require('@jeffreyleec/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(arry)
: returns first index, arry[0]tail(arry)
: returns string - head, arry[1] and onwardmiddle(arry)
: returns middle value of array. If even returns two numbers.assertArraysEqual(actual, expected)
: compares two arraysassertEqual(actual, expected)
: compares two values.countLetters(str)
: counts number of each letter in strcountOnly(allItems, itemsToCount)
: counts certain keys in a list.eqArrays(actual, expected)
: compares two arrays ===eqObjects(object1, object2)
: returns true/false if objects are ===findKey(object,callback)
: returns key with most 'callback' valuefindKeyByValue(object,value)
: searches object using value returns keyflatten(arry)
: turns simple nested arrays into one arrayletterPositions(word)
: tracks # of letters and the respective indexmap(array, callback)
: maps the array callback conditionreverse(input)
: reversetakeUntil(array, callback)
: returns character(s) of array untill 'callback' conditionwithout(source, itemsToRemove)
: removes 'itemsToRemove' from 'source'pigLatin(input)
: takes in a string applies pig latin. IG - P - AY.