1.0.0 • Published 5 years ago
@angelblacite/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 @angelblacite/lotide
Require it:
const _ = require('@angelblacite/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
_.head(arr): return the first element (index0) of the input array_.tail(arr): return a copy of input array with the first element (index0) removed_.middle(arr): return an array containing the middle element(s) of input array_.assertArraysEqual(...): assert if two arrays are equal_.assertEqual(...): assert if two elements are equal_.countLetters(...): count what letter presence and no. of occurence_.countOnly(arr, obj): count occurence in array as specificed in obj_.eqArrays(arr1, arr2): eval if two arrays are equal_.eqObjects(obj1, obj2): eval if two objects are equal_.findKey(obj, callback): when callback return true, return key_.findKeyByValue(obj, val): return the key of key/val pair from an object_.flatten(arr): return a flat array by flattening the input nested array_.letterPositions(string): return an object with each diff letter as key, and the index of where it appears_.map(arr, callback)return an array with each element from input array processed by the callback_.takeUntil(arr, callback): return a copy of input array with every element until callback function return true_.without(arr, exceptionEle): return a copy of input array with exceptionEle removed
1.0.0
5 years ago