1.0.0 • Published 3 years ago
@gerard-c/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 @gerard-c/lotide
Require it:
const _ = require('@gerard-c/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: receive 2 arrays and print whether or not they are equalassertEqual
: receive 2 values and print whether or not they are equalassertObjectsEqual
: receive 2 objects and print whether or not they are equalcountLetters
: receive a string and output an object displaying how often each character occurscountOnly
: receive an array and an object designating which items should be counted, outputs an object displaying amount of times each specified item occurs in arrayeqArrays
: receive 2 arrays and output true if they are equal and false if they are noteqObjects
: receive 2 objects and output true if they are equal and false if they are notfindKey
: receive an object and a callback function specifying desired value, outputs key found by functionfindKeyByValue
: receive an object and a string representing desired value, outputs key matching valueflatten
: receive a nested array and outputs an array with one level of nesting removedhead
: receive an array and output the value at index 0letterPositions
: receive a string and output an object with characters as keys and arrays with their indicies as valuesmap
: receive an array and a callback function, outputting a new array with each value in input array modified by functionmiddle
: receive an array and output an array with the middle value(s) of inputtail
: receive an array and output a new array containing all but the first value in the input arraytakeUntil
: receive an array and a callback function to check each value in array for specific truthy value, returning an array with every value prior to the truthy valuewithout
: receive two arrays, returning the first array minus the contents of the second
1.0.0
3 years ago