@mpnose/lotide
v1.0.0
Published
A mini clone of the lodash library
Downloads
75
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 @mpnose/lotide
Require it:
const _ = require('@mpnose/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: compares two arrays for equalityassertEqual(actual, expected)
: compares two items for equalityassertObjectsEqual(actual, expected)
: takes in two objects an compares them for equalitycountLetters(string)
: intakes a string of letters and outputs the number of letters in the stringcountOnly(allItems, itemsToCount)
: intakes two lists and returns the count of the requested itemseqArrays(arr1, arr2)
: takes in two arrays and confirms if they are equaleqObjects(object1, object2)
: takes in two objects and confirms if they are equalfindKey(object, callback)
: takes in and object and finds the key based on value input parametersfindKeyByValue(object, value)
: intakes an object and value and determines the key associated with valuehead(arr)
: takes in an array and returns the first elementletterPositions(sentence)
: intakes a sentence and returns the index points of each lettermap(array, callback)
: creates a new array of an input array, with callback parameters addedmiddle(array)
: intakes an array and returns the middle one or two elementstail(array)
: intakes an array and returns all but the first elementstakeUntil(array, callback)
: inputs an array and a callback function outputs until callback parameters metwithout(source, itemsToRemeve)
: returns an array with selected items filtered out