1.0.0 • Published 2 years ago
@brendanzfunk/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 @brendanzfunk/lotide
Require it:
const _ = require('@brendanzfunk/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArrayEqual(array,array)
: console logs the result of eqArraysassertEqual(value,value)
: checks if two things are equal and console logs the outputassertObjectsEqual(object,object)
: console.logs the output of eqObjectscountLetters(string)
: counts the amount of times letters appear in a stringcountOnly(object,object)
: counts values in an object, only what is specifiedeqArrays(array,array)
: check if arrays are equaleqObjects(object,object)
: checks if two objects are equalfindKey(object,function)
: finds the key of an object based on a callback functionfindKeyByValue(object,value)
: returns the key of an object by its valueflatten(array)
: takes a multi dimensional array and condenses it into traditional arrayhead(array)
: gets the first element of an arrayletterPositions(string)
: returns an object of all the positions a letter has shown up in a stringmap(array,function)
: loops through an array pushing items into a new array based on callback functionmiddle(array)
: get middle values of an arraytail(array)
: returns an array of everything but the head of the arraytakeUntil(array,function)
: goes through an array pushing items into a new array until the condition of the callback is metwithout(array,array)
: returns new array without the matching terms in the second array
1.0.0
2 years ago