1.0.1 • Published 3 years ago
@rileyjfournier/lotide v1.0.1
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 @rileyjfournier/lotide
Require it:
const _ = require('@rileyjfournier/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
_.assertArraysEqual
: returns true if arr1 and arr2 are equal, else false_.assertEqual
: returns true if element1 and element2 are equal, else false_.assertObjectsEqual
: returns true if obj1 and obj2 are equal, else false_.countLetters
: returns an obj when given a string { letter1: 'times found', letter2: 'times found', ... }_.countOnly
: counts only the array elements given in the second argument_.eqArrays
: returns true if arr1 and arr2 are equal, else false_.eqObjects
: returns true if obj1 and obj2 are equal, else false_.findKey
: find key with callback function_.findKeyByValue
: find key with value_.flatten
: "flatten" nested arrays into 1 layer_.head
: return the "head" element of an array_.letterPositions
: when given a string, returns an object with characters as keys and their stringindex as values_.map
: performs a callback function on every element of an array_.middle
: when given an array, finds the middle index element (middle two if array.length is even)_.tail
: when given an array, returns all tail elements_.takeUntil
: when given an array, will return a new array, taking elements from the source until specified_.without
: function that removes stated items from the source