@brettg17/lotide
v1.1.1
Published
Lighthouse Labs Lotide Project
Downloads
8
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 @brettg17/lotide
Require it:
const _ = require('@brettg17/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: tests whether two arrays are equal or notassertEqual(actual, expected)
: tests if a functions actual return is equal to the expectedassertObjectEqual(actual, expected)
: test whether two objects are equalcountLetters(chars)
: counts letters in a stringcountOnly(allItems, itemsToCount)
: checks how many times and item is in an array. returns undefined if noteqArrays(arrayOne, arrayTwo)
: tests to see if two arrays are equaleqObjects(object1, object2)
: tests to see if keys and values in an object are equalfindKey(obj, callback)
: uses callback and returns true if truthy value is meant. if not return undefinedfindKeyByValue(genre, show)
: finds key by value. if value/key is not in the object return undefinedcountOnly(allItems, itemsToCount)
: checks how many times and item is in an array. returns undefined if notflatten(arr)
: takes an array with elements that include nested arrays. removes nested arrays creating a "flattened" arrayhead(arr)
: returns first element of an arrayletterPositions(sentence)
: returns what position letters in a string are in.map(array, callback)
: map function returns an array based on the reults of the callback functionmiddle(array)
: returns middle element of an array. middle two elements of even. empty array if two elements or lesstail(arr)
: creates new array exluding first element in original arraytakeUntil(array, callback)
: return elements in an array up to the point truthy condition is met.without(source, itemsToRemove)
: whatever elements that are in first array but not in second will get pushed into new array.