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 @sherrynganguyen/lotide
Require it:
const _ = require('@sherrynganguyen/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: A function takes in two arrays and print an appropriate message to consoleassertEqual(actual, expected)
: A function compares two values and print out a message telling users if they match or notassertObjectEqual(object1, object2)
: A function takes in two objects and print an appropriate message to the consolecountLetter(strToCheck)
: A function counts how many times letters appearcountOnly(allItems, itemsToCount)
: A function only returns if the itemsToCount appears and how many times it appearseqArrays(array1, array2)
: A function takes in two arrays and returns true or false, based on a perfect matcheqObjects(object1, object2)
: A function takes in two objects and returns true or false, based on a pefect matchfindKey(keyList, callback)
: A function takes in an object and a callback, scan through the object and return the first key where the callback returns true. If no key found, return undefinedfindKeyByValue(object, searchValue)
: A function help searching for a key on an ojects where its value matches a given valueflatten(array)
: A function flatten the given array into single-level arrayhead(array)
: A function returns the item in the arrayletterPositions(sentence)
: A function reutrns all the indices(zero-based positions) in the string where each character is foundmap(array, callback)
: A function takes in two arguments: an array to map and a callback function. It will then return a new array based on the results of the callback functionmiddle(array)
: A function takes in an array and returns the middle-most element(s) of the given arraytail(array)
: A function returns back the given array expect the first itemtakeUntil(array, callback)
: A function takes an array to work with and a callback functions. It then returns a truthy valuewithout(source, itemsToRemove)
: A function returns a subset of a given array, removing unwanted elements