1.0.0 • Published 4 years ago
@michellelindseyv/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 @michellelindseyv/lotide
Require it:
const _ = require('@michellelindseyv/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(...)
: evaluate if the array returned is equal to expected return valueassertEquals(...)
: evaluates if two arrays are equalassertObjectsEqual(...)
: evaluates if the key object pairs of two different objects are equalcountLetters(...)
: takes in a sentence (as a string) and then returns a count of each of the letters in that sentencecountOnly(...)
: takes in a group of items and returns counts for a defined subset of those itemseqArrays(...)
: takes in two arrays and returns true or false based on a perfect matcheqObjects(...)
: takes in two objects and return true or false based on a perfect matchfindKey(...)
: takes an object and a callback and returns the first key for which the callback returns a truthy value.findKeyByValue(...)
: takes an object and value. Returns the first key which contains the given value. If no key with that given value is found, it returns undefined.head(...)
: retrieves the first element from an arrayletterPositions(...)
: returns all the indices in the string where each character is found.map(...)
: returns a new array based on the results of the callback functionmiddle(...)
: returns middle two values if array length is even, single middle value if array is uneven and and empty array if there are two values or lesstail(...)
: removes the first index of an array and returns the remainingtakeUntil(...)
: returns values in the array until a specified condition is metwithout(...)
:
1.0.0
4 years ago