1.1.0 • Published 4 years ago
@thaian161/lotide v1.1.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 @thaian161/lotide
Require it:
const _ = require('@thaian161/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(arr): function to retrieve the first element from the arraytail(arr): function to retrieve every element except the head (first element) of the arraymiddle(arr): function return an array with only the middle element(s) of the provided arraycountLetters(str): function should take in a sentence (as a string) and then return a count of each of the letters in that sentencecountOnly(allItems, itemsToCount): function should take in a collection of items and return counts for a specific subset of those items. countOnly will be given an array and an object. It will return an object containing counts of everything that the input object listedfindKey(obj, cb):function scan the object and return the first key for which the callback returns a truthy valuefindKeyByValue(obj, valueOfObj): function search for a key on an object where its value matches a given valueletterPositions(sentence): function return all the indices (zero-based positions) in the string where each character is foundmap(arr, cb): function will return a new array based on the results of the callback function. Manually rewrite .map()takeUntil(arr, cb): function will return a slice of the array with elements taken from the beginningwithout(source, itemsToRemove): function to filter our data by removing some unwanted items from given arrayeqArrays(arr1, arr2): function that can compare two arrays for a perfect matcheqObjects(obj1, obj2): function takes in two objects and returns true or false, based on a perfect match