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 @seanoyler/lotide
Require it:
const _ = require('@seanoyler/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2)
: Test to see if two arrays are equal. Reports Success if they are Fail if they are notassertEqual(arr1, arr2)
: Test to see if two values are strictly equal.assertObjectsEquals(obj1, obj2)
: Test to see if two objects passed in are equal.countLetters(str)
: Takes a string and returns an object with the counts of each lettercountOnly(allItems, itemsToCount)
: Takes a list of items and returns an object with counts of items specifically passed in as itemsToCounteqArrays(arr1, arr2)
: Takes two arrays and compares them together to see if they are equaleqObjects(obj1, obj2)
: Takes two objects and compares them together to see if they are equalfindKeys(obj, callback)
: Takes an object and call back function to return the key(s) where the result of the callback are truefindKeyByValue(obj, value)
: Takes an object, searches for a key containing the value passed and returns the keyflatten(arr)
: Takes a multi-dimensional array, concats all arrays together to form one array. Returns the new array.head(arr)
: Returns the first element of an arrayletterPositions(str)
: Takes a string and returns an object where each key is a letter that appears in the string. Their respective values are an array of the positions at which those letters appearmap(array, callback)
: Takes an array and performs the callback function on each element, creating and returning a new arraymiddle(array)
: Takes an array and returns the middle elementtail(array)
: Takes an array and returns all elements except the firsttakeUntil(array, callback)
: Takes an array and a callback, pushing the elements of the original array into a new array until the conditions of the callback are reached.without(array, itemToRemove)
: Returns a new array with all the elements of the array passed in except for those defined in the itemsToRemove parameter