1.0.0 • Published 5 years ago
@jsaputo/lotide v1.0.0
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 @jsaputo/lotide
Require it:
const _ = require('@jsaputo/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)): Compares two arrays and determines if they are equalassertObjectsEqual(object1, object2): Compares two objects and determines if they are equalassertEqual(actual, expected): Compares two strings and determines if they are equalcountLetters(phrase): Counts all the letters in a given phrasecountOnly(allItems, itemsToCount): Counts the number of times a letter is in a given phraseeqArrays(array1, array2): Checks the length of 2 arrays and if their values are equaleqObjects(object1, object2): Checks the length of 2 objects and if their values are equalfindKey(object, callBack): Takes in an object and a value. Scans through the object and returns the key when the value is found.findKeyByValue(object, value): Takes in an object and a value. Scans through the object and stops after the value is found.head(array): Returns the first value in an arraytail(array): Returns the array without the first valueletterPositions(sentence): Returns the index where is a letter is found. E.g. "hello".e will return 1map(array,Callback): Takes in an array an a callback, returns a new array based on the callback.middle(array): Takes in an array and return the middle values.takeUntil(array, callback): Takes in an array and a callback, returns a new array of values until the callback found.without(array, itemsToRemove): Takes in an array and removes the value that is specified.
1.0.0
5 years ago