1.0.0 • Published 2 years ago
@pauline-shen/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 @pauline-shen/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2)
: log whether two arrays (arr1, arr2) are equalassertEqual(actual, expected)
: log whether two items are equalassertObjectsEqual(actual, expected)
: log whether two objects are equalcountLetters(sentence)
: return occurence of each letter in a sentencecountOnly(allItems, itemsToCount)
: return count of specific strings (itemsToFCocunt) in allItemseqArrays(arr1, arr2)
: return whether two arrays (arr1, arr2) are equaleqObjects(object1, object2)
: return whether two objects (object1, 2) are equalfindKey(obj, callback)
: return key of first key in obj that has value make callback function return truefindKeyByValue(obj, val)
: return the key in obj that has the value indicated as valflatten(arr)
: return flattened arr with one level of nested arrayhead(arr)
: return first item in an arrletterPositions(sentence)
: return key as each letter in sentence and value is occurrence indices in arraymap(array, callback)
: return array being mapped two the callback functionmiddle(arr)
: return array that contains middle element(s) in arr
1.0.0
2 years ago