1.0.1 • Published 2 years ago
@mozeezy/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 @mozeezy/lotide
Require it:
const _ = require('@mozeezy/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: assert if two arrays are equal.assertEqual
: assert if two values are equal.assertObjectsEqual
: assert if two objects are equal.countLetters
: count each letter in a string.countOnly
: count how many occurrences of a specific item in a collection of items.eqArrays
: compare two arrays.eqObjects
: compare two objects.findKey
: returns the first key based on the truthy outcome of the callback function.findKeyByValue
: searches for a specific key based on a given value.head
: return the first element of an array.index
: list all the lotide functions in a single object.letterPositions
: return the position of each character in a string.map
: return a new array based on the results of the callback functionmiddle
: return the middle element(s) in an array.tail
: return every element in the array minus the first element (head).takeUntil
: returns an array with sliced elements from the beginningwithout
: takes in 2 arrays: a source array and a toRemove array. returns a new array with elements in the source array that are not present in the 'toRemove' array.