1.0.0 • Published 3 years ago
@burke-md/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 burke-md/lotide
Require it:
const _ = require('burke-md/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: Returns the first eleement of an array.tail
: Returns all but the first element of an array without altering the arr.middle
: Returns the middle or middle two (if array has an even number of elements) elements of an arrya.countLetters
: Returns an object with the frequenecy of each letter of a given string.countOnly
: Acepts an array of strings and an object of strings with T/F values that dictate which strings are to be counted. Returns an object with the frequency of each string ex. countOnly(bill, bob, {bill: true, bob: false})findKey
: Returns the key from an input object whose value passes the criteria of a callback function findKey(object, callback)findKeyByValue
: Given an object and a value, this function will return the corosponding key findKayByValue(obj, value)letterPositions
: Returns an object containing each letter as a kay and an array of each index occurance of that letter as a value letterPositions(string)map
: Returns an array with the callback function applied to each array element map(arr, callback)takeUntil
: Returns an array with each element of the input arr UNTIL the callback no longer accepts. takeUntil(arr, callback)withOut
: Returns an array without the element specified by the arguments withOut("inputArr", "removeThisElement )assertArraysEqual
: Compares (T/F) ArraysassertEqual
: Compares (T/F) simple ===assertObjectsEqual
: Compares (T/F) ObjectseqArrays
: Compares (T/F) ArrayseqObjects
: Compares (T/F) Objects
1.0.0
3 years ago