@politecrow/lotide
v1.0.0
Published
A mini clone of the Lodash library. Created for learning purposes during Lighthouse Labs Web Development Bootcamp
Downloads
4
Readme
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 @BronwenM/lotide
Require it:
const _ = require('@BronwenM/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: Compare two arrays with eqArrays and return log statements based on equalityassertEqual
: Compare two primitive inputs and return return log statements based on equalityassertObjectsEqual
: Compare two objects with eqObjects and return log statements based on equalitycountLetters
: Count each instance of a letter in a string, return an object with key/value pairs for each unique letter in the stringcountOnly
: Count the number of items in an array, as listed in the object as "true" return an object with key/value pairs for each unique element in the arrayeqArrays
: Compare two arrays and return true/false for strict equalityeqObjects
: Compare two objects and return true/false for equalityfindKey
: Loop through object values by key. If the callback param returns true from a value return the keyfindKeyByValue
: Return the 1st key in an object with that match value param. If no value matches return undefinedflatten
: Recursively flatten a nested set of arrayshead
: Return the first element in an arrayletterPositions
: Return the positions of each letter in a string as an object with each unique letter as a keymap
: Perform operation on each element of input array as defined by callback, return new array with altered elementsmiddle
: Return the middle item in an array. If the array has an even number of items, return both middle items.tail
: Remove the first element in an array and return the trailing elementstakeUntil
: Take elements from the start of an array until a condition from callback is satisfied. Return new array of elementswithout
: Remove elements from the source array that match the itemsToRemove param