1.0.0 • Published 2 years ago
@pmungra/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 @pmungra/lotide
Require it:
const _ = require('@pmungra/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
- assertArraysEqual(actual, expected): compares two arrays for equality.
- assertEqual(actual, expected): compares actual and expected input values.
- assertObjectsEqual(actual, expected): compares two objects for equality.
- countLetters(word) : take in a sentence (as a string) and then return a count of each of the letters in that sentence.
- countOnly(allItems, itemsToCount): counts items in a list, and their presence in an array.
- eqArrays(arr1, arr2): compares individual elements of two arrays for equality.
- eqObjects(object1, object2): compares individual key value pairs of two objects for equality.
- findKey(object,callback): finds the key in an object that satisfies the callback function.
- findKeyByValue(obj, val): find the key in an object given the value of the key val pair.
- head(arr): returns the first value in an array.
- index : exports the three functions we've listed.
- letterPositions: return all the indices (zero-based positions) in the string where each character is found.
- map(array, callback): runs the callback function on each value of a given array.
- middle(arr): returns the middle value or values of an array.
- tail : returns every element except the head (first element) of the array.
- takeUntil(array, callback): returns all values of an array until the callback function is satisfied.
- without(source, itemstoRemove): removes elements from an array given an array of items to remove.
1.0.0
2 years ago