1.3.0 • Published 3 years ago
@soliloquiy/lotide v1.3.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 @soliloquiy/lotide
Require it:
const _ = require('@soliloquiy/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: Returns the first item in an arraytail(array)
: Returns all items in an array except for the firstmiddle(array)
: Returns the middle item(s) in an array based on its lengthassertArraysEqual(actual, expected)
: Returns a console log based on arrays being compared while utilizing eqArraysassertEqual(actual, expected)
: Returns true or false based on primitives being comparedassertObjectsEqual(actual, expected)
: Returns a console log based on objects being compared while utilizing eqArrayscountLetters(str)
: Returns object of number of times a letter appears in a given stringcountOnly(allItems, itemsToCount)
: Returns object with count for number of time value appears based on given listeqArrays(arr1, arr2)
: Returns true or false based on arrays being compared in an arrayeqObjects(object1, object2)
: Returns true or false based on objects being comparedfindKey(object, callback)
: Returns the first key corresponding to the value that callback function equates tofindKeyByValue(obj, value)
: Returns key for corresponding value inputtedletterPositions(sentence)
: Returns the index of each place a letter appears and places in an objectmap(array, callback)
: Returns an array after performing a callback on each item in the arraytakeUntil(array, callback)
: Returns an array of the original with values until callback condition terminates itwithout(arr1, arr2)
: Returns an array without values defined in arr2