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 @mkmiecik/lotide
Require it:
const _ = require('mkmiecik/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
- head: Gives the first item in an array; undefined if the array is empty. 2)tail: Gives everything but the first item in an array; returns an empty array if array is empty.
- middle: Gives the middle element(s) of a given array(even length = 2 elemtnts, odd - 1 element3) ) for arrays with one or two elements, return an empty array. 3)without: Gives a subset of a given array, removing unwanted elements. 4)countOnly: Gives counts for a specific subset of inputted items; 5)countLetters: Gives counts for the given characters of a inputted string. 6)letterPositions: Gives all the indicies (zero-based positions) in the string where each character is found. 7)findKeyByValue: Gives the first key containing the value of the inputted object and value. If no key with the given value is found, return undefined.
- map: Returns a new array based on the map function.
- takeUntil: Returns a truthy value based on a given array and callback which are passed as parameters of the takeUntil function. 10)findKey: Returns a truthy value based on a given object and callback which are passed as parameters of the findKey function. If no key is found, return undefined.