@vbedardl/lotide
v1.0.0
Published
Small lodash copycat made with Lighthouse Lab Bootcamp
Readme
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 @vbedardl/lotide
Require it:
const _ = require('@vbedardl/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function tail([array]): return the tail of the array as an array (the array minus the first element)function head([array]): return the head of the array as an array (the first element of the array)function middle([array]): return the middle of the array as an array. 1 element when the array's length is odd, 2 element when the length is evenfunction countLetters(string): return an object with each letters from the string and their count. "LOL" => {L:2, O:1}function countOnly([arrayOfItems], {objectOfItemsToCount}] ): return an object with the element to count and their count in the given array of itemsfunction eqArray([array1], [array2]): return true if the two arrays are identicalfunction eqObject({obj1}, {obj2}): return true if the two objects are identicalfunction findKey({obj1}, callback): return the value given a key from a defined objectfunction findKeyByValue({obj1}, string): return the key given a value from a defined objectfunction flatten([array1]): return a flatten array from an array with nested arraysfunction letterPositions(string): return an object with letters and their position from a given stringfunction map([array], callback): create a map function. given an array of element and a callbackfunction takeUntil([array], callback): return the elements of an array up to a breaking point, defined by the callbackfunction without([array1], [array2]): return array1 without the element of array2
