1.0.2 • Published 3 years ago
@edwardkinglee/lotide v1.0.2
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 @edwardkinglee/lotide
Require it:
const _ = require('@edwardkinglee/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2): Will console.log out if Arrays are === or !==assertEqual(actual, expected): Compares two values to see if they are strictly equal === or !==assertObjectsEqual(actual, expected: Compares two objects to see if they are strictly equal === or !==countLetters(sentence): Counts letters in a sentence and returns a object with letter countcountOnly(allItems, itemsToCount): allItems: an array of strings that we need to look through. itemsToCount: an object specifying what to counteqArrays(array1, array2): Compares if two arrays are === or !==findKey(object, callback): Uses a callback function to find specified key in a object, returns found key or undefined if not foundfindKeyByValue(object, value):Finds specified value in a object, returns found key or undefined if not foundflatten(array): Flattens nested array and returns new flattened arrayhead(array): Returns value of element at index 0 of array or 'undefined' if array length is 0.letterPositions(sentence): Returns object with the index of letter positions from a sentencemap(array, callback): Takes in a array and returns a new altered array based on callback functionmiddle(array):Returns the middle array element if array has a odd number of elements, if even will return middle 2 elementstail(array): Returns new array with all array elements starting at index 1, if array lenght is 1 will return []takeUntil(array, callback): Returns new array until element provided in callback function states when to stopwithout(sourceArray, itemsToRemove): Returns new array without the elements included in the itemsToRemove array