1.0.0 • Published 5 years ago
@firebfm/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 @firebfm/lotide
Require it:
const _ = require('@firebfm/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(arr): return first itemcountLetters(str): return a count of each lettercountOnly(allItems, itemsToCount): allItems: an array of strings that we need to look through, itemsToCount: an object specifying what to countassertArraysEqual(arr1, arr2): assert if two arrs are equalassertEqual(value1, value2): assert if 2 values are equalassertObjectsEqual(obj1, obj2): assert if 2 objs are equaleqArrays(arr1, arr2): check for equality between 2 arrays.eqObjects(obj1, obj2): check that 2 objects are equal.findKey(obj, callback): callback returns a truthy value, scan the object for the first key that matchesfindKeyByValue(obj, value): returns the key of the value.letterPositions(str): returns all the indices/position of each character in the stringmap(arr, callback): apply the callback on the arrmiddle(arr): returns the middle element of an arraytail(arr): returns the array except for the first elementtakeUntil(arr, callback): returns an array until the callback stop conditionwithout(source, itemsToRemove): returns a new array based on filter
1.0.0
5 years ago