1.0.1 • Published 5 years ago
@bchangg/lotide v1.0.1
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 @username/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: Assertion function to see if two arrays are exactly equal to each otherassertEqual
: Assertion function to see if two values are equal (primitive type test)assertObjectsEqual
: Assertion function to see if two objects are exactly equalcountLetters
: Function returns an object that counts how many times each letter has appeared in a stringcountOnly
: Function takes in two parameters: one for all items to be checked, and one for what you want to check. Returns an object that counts how many times items in the second array have appeared in the firsteqArrays
: Comparison function that returns true if the two arrays given are equal, and false otherwiseeqObjects
: Comparison function that returns true if the two objects given are exactly equal, and false otherwisefindKey
: Function takes in a value and returns the key of said valuefindKeyByValue
: Function takes in an object and a value, and returns the key of said valueflatten
: Function removes all the arrays inside the given array and returns flattened arrayhead
: Function takes in an array and returns the first item in the arrayletterPositions
: Function takes in a string and returns an object with how many times each character appears in the stringmap
: Function takes in an array and a callback function, and returns a mutated array based on the user's given callback functionmiddle
: Function takes in an array and returns an array of values of the index(es) in the middle. 1,2,3 => 2. 1,2,3,4 => 2,3tail
: Function takes in an array and returns an array of everything except the first valuetakeUntil
: Function takes in an array and a callback function, and returns an array filled with the results from the user's given functionwithout
: Function takes in an array to look through and an array of items to exclude, and returns an array filled without the values in the forRemoval array