1.0.0 • Published 3 years ago
@devhan1207/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 @devhan1207/lotide
Require it:
const _ = require('@devhan1207/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual: This function takes two arrays as input and prints assertion passed if two arrays are the same and assertion failed if not.assertEqual: This function takes and compares the two values which are primitive types (like numbers and strings), and print out a message telling us if they match or not.assertObjectsEqual: This function takes in two objects and print out a message telling us if they match or not.countLetters: This function takes in a sentence (as a string) and then return a count of each of the letters in that sentence.countOnly: This function takes in a collection of items and return counts for a specific subset of those items.eqAttays: This function takes in two arrays and returns true or false, based on a perfect match.eqObjects: This function takes in two objects and returns true or false, based on a perfect match.findKey: This function takes in an object and a callback. It scans the object and return the first key for which the callback returns a truthy value. If no key is found, then it returns undefined.findKeyByValue: This function takes in an object and a value. It scans the object and return the first key which contains the given value. If no key with that given value is found, then it returns undefined.flatten: This function takes an array and unnest the array if nested.head: This function takes an array and returns the first element in the array.index: This exports three functions(head,tail,middle) simultaneously.letterPositions: This function takes in a sentence (as a string) and then return all the indices (zero-based positions) in the string where each character is found.map: This function takes an array and function to map the array. It returns a mapped array.middle: This function takes in an array and return the middle-most element(s) of the given array.tail: This function takes an array and returns every element except the head (first element) of the array.takeUntil: This function takes an array and function returns the array where its elements are deleted when the callback function returns false.without: This function takes in a source array and a itemsToRemove array. It should return a new array with only those elements from source that are not present in the itemsToRemove array.
1.0.0
3 years ago