1.0.0 • Published 5 years ago
@therealarcher/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 @therealarcher/lotide
Require it:
const _ = require('@therealarcher/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function1(head)
: returns the first item in an arrayfunction2(tail)
: returns everything but the first item in the array (the head)function3(middle)
: takes an array as an input and returns an array of the middle index(s)function4(assertArrayEqual)
: Like eqArrays, but with a more relevant messagefunction5(assertEqual)
: returns if an expected outcome is met or notfunction6(assertObjectsEqual)
: returns whether 2 objects are the same witha relevant messagefunction7(countLetters)
: takes a string and returns an object with the count of the each letterfunction8(countOnly)
: takes an array and returns the number of occurences of each elementfunction9(eqArrays)
: takes 2 arrays and returns whether they are equalfunction10(eqObjects)
: takes 2 objects and returns whether they are equalfunction11(findKey)
: takes an object as an input and returns the key to the associated valuefunction12(findKeyByValue)
: takes an object and a value and returns the first key which contains the given valuefunction13(flatten)
: takes an array or an array of arrays and returns a single array with all of the elementsfunction14(letterPositions)
: takes a string an a value and returns the indexed position(s) of the value inputtedfunction3(map)
: takes an array of strings and returns a new array with just the first index of each of the inputted stringsfunction1(takeUntil)
: returns a slice of an array from elements taken from the beginning up until the inputted valuefunction2(without)
: takes 2 arrays, a source and one with 'items to remove' and returns a new array containing none of the 'items to remove'
1.0.0
5 years ago