@fatimaaltaf/lotide
v1.0.0
Published
lotide library created as part of project for Lighthouse Labs
Downloads
4
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 @fatimaaltaf/lotide
Require it:
const _ = require('@fatimaaltaf/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected): takes in two arrays and console.logs an appropriate message to the console.assertEqual(actual, expected): series of success / failure messages printed to the console.assertObjectsEqual(actual, expected): helps easily test functions that return objects.countLetters(allLetters): takes in a collection of items and returns counts for a specific subset of those items.countOnly(actual, expected): takes in a collection of items and returns counts for a specific subset of those items.eqArrays(array1, array2): takes in two arrays and returns true or false, based on a perfect match.eqObjects(object1, object2): takes in two objects and returns true or false, based on a perfect match.findKey(obj, callback): helps search for a key on an object where its value matches a given value.findKeyByValue(bestShows, value): finds key in an object through the value.flatten(array): take in an array of arrays and returns a "flattened" version of the array.head(array): retrieves the first element from the array.letterPositions(sentence): returns all the indices (zero-based positions) in the string where each character is found.map(array, callback): callback function using map.middle(array): takes in an array and return the middle-most element(s) of the given array.tail(array): retrieves every element except the head (first element) of the array.takeUntil(array, callback): callback function.implementWithout(source, itemsToRemove): returns a subset of a given array, removing unwanted elements.
