1.0.1 • Published 3 years ago
@fuzzykittyz/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 @fuzzykittyz/lotide
Require it:
const _ = require('@fuzzykittyz/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2): checks to see if 2 arrays are equal or notassertEqual(actual, expected): checks to see if 2 primitives are equal or notassertObjectsEqual(actual, expected): checks to see if 2 objects with no arrays are equalcountLetters(sentence): takes in a string and counts the letter and how many times they appear in the stringcountOnly(allItems, itemsToCount): counts the items from itemsToCount in allItemseqArrays(arr1, arr2): function that checks if 2 arrays are the sameeqObjects(object1, object2): chceks to see if 2 objects are equalfindKey(obj, cb): checks the obj using the cb function and returns the first value in obj that passes the cb function as truefindKeyByValue(object, value): checks the obj for a given value and returns the first thing that is equal to that valueflatten(arr): flattens a given array using the built in .flat() functionhead(array): returns the first element of a given arrayletterPosition(sentence): returns arrays of each letter and their locations as indices within an arraymap(array, callback): a function that uses the built in .map() functionmiddle(arr): takes in an array and returns the middle element or two middle elements in an array (depending on if the amount of elements is odd or even)tail(arr): returns everything in a given array but the first elementtakeUntil(array, cb): returns a new array that takes in every element of the original array till the element returns true when passed through the callback functionwithout(source, itemsToRemove): removes items in itemsToRemove from the source and returns source without them