1.0.0 • Published 4 years ago
@staceykeating/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 @staceykeating/lotide
Require it:
const _ = require('@staceykeating/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(...)
: returns a pass or fail message if two arrays are equalassertEqual(...)
: returns a pass or fail message if two primitive data types are equalassertObjectsEqual(...)
: returns a pass or fail message if two objects are equalcountLetters(...)
: creates an object with keys for each letter in argument and values of amount of occurancescountOnly(...)
: take in a collection of items and return counts for a specific subset of those itemseqArrays(...)
: checks if arrays or equal and returns true or falsefindKey(...)
: takes in an object and a callback. scans object and returns first key for which the callback returns a truthy value. if not found returns undefined.findKeyByValue(...)
: takes in an object and a value. scans object and returns first key which contains the given value. if not found returns undefined.flatten(...)
: takes nested arrays and returns a single array.head(...)
: returns the first element from an array.letterPositions(...)
: creates an object from letters passed which values contain the index of each letters positions.map(...)
: returns first character for each item in an array.middle(...)
: returns the middle item or items in an array.sayHelloTo(...)
: says hello when name is inserted.tail(...)
: returns everything but the head.takeUntil(...)
: returns a slice of an array with elements up until until the callback/predicate returns truthy.without(...)
: takes in source array and itemsToRemove array and returns new array with only the elements not present in the itemsToRemove array.
1.0.0
4 years ago