1.0.0 • Published 4 years ago
@ericmcgrandle/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 @ericmcgrandle/lotide
Require it:
const _ = require('@ericmcgrandle/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arrOne, arrTwo)
: console.logs the return value from EqArraysassertEqual(actual, expected)
: compare two primitive data types for strict equalityassertObjectsEqual(obj1, obj2)
: console.logs the return value from eqObjectscountLetters(str)
: returns object with number of each letter in stringcountOnly(allItems, itemsToCount)
: Takes in two arrays, only counts in the items inside allItems if they also belong in itemsToCounteqArrays(arrOne, arrTwo)
: checks two arrays for equalityeqObjects(object1, object2)
: checks two objects for equalityfindKey(obj, callback)
: returns obj value if it matches callback return valuefindKeyByValue(obj, value)
: returns key from obj if value matches valueflatten(array)
: console.log nested array valueshead(array)
: returns first element of arrayletterPosition(sentence)
: returns indexes where letters appearmaps(array, callback)
: performs callback function on each item in arraymiddle(array)
: returns middle element in arraytail(array)
: returns tail of arraytakeUntil(array, callback)
: returns a slice of the array until callback returns truthy valuewithout(array, itemsToRemove)
: removes itemsToRemove from array
1.0.0
4 years ago