1.0.0 • Published 6 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 array
- function2(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 message
- function5(assertEqual): returns if an expected outcome is met or not
- function6(assertObjectsEqual): returns whether 2 objects are the same witha relevant message
- function7(countLetters): takes a string and returns an object with the count of the each letter
- function8(countOnly): takes an array and returns the number of occurences of each element
- function9(eqArrays): takes 2 arrays and returns whether they are equal
- function10(eqObjects): takes 2 objects and returns whether they are equal
- function11(findKey): takes an object as an input and returns the key to the associated value
- function12(findKeyByValue): takes an object and a value and returns the first key which contains the given value
- function13(flatten): takes an array or an array of arrays and returns a single array with all of the elements
- function14(letterPositions): takes a string an a value and returns the indexed position(s) of the value inputted
- function3(map): takes an array of strings and returns a new array with just the first index of each of the inputted strings
- function1(takeUntil): returns a slice of an array from elements taken from the beginning up until the inputted value
- function2(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
6 years ago