@bendhal/lotide
v1.0.0
Published
A mini clone of [Lodash](https://lodash.com) library for educational purposes.
Downloads
1
Readme
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 @bendhal/lotide
Require it:
const _ = require('@bendhal/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2)
: prints a message to the console declaring wether two arrays are entirely equalassertEqual(value1, value2)
: prints a message to the console declaring wether two values are entirely equalassertObjectsEqual(object1, object2)
: prints a message to the console declaring wether two objects have entirely matching key value pairscountLetters(string)
: counts the number of letters in a stringcountOnly(array, toCount)
: counts the number of times a specified entry shows up in an arrayeqArrays(array1, array2)
: checks if two arrays are entirely equal and returns true or falseeqObjects(object1, object2)
: checks if two objects are entirely equal and returns true or falsefindKey(object, function)
: searches through an object and returns first key that returns a truthy answer to the callback functionfindKeyByValue(object, value)
: searches through an object and returns first key that has the specified valueflatten(array)
: takes an array and finds any sub arrays and adds their elements to the main array subsequently removing said sub-arrayhead(array)
: takes an array and returns the first entryletterPositions(string)
: creates an object that logs an array of indices for each letters position in the specified stringmap(array, callback)
: applies a callback to each element of an array and create a new array with the returned values of that callbackmiddle(array)
: returns the middle elements of an arraytail(array)
: returns every element of an array except for the first elementtakeUntil(array, callback)
: adds elements of an array to a new array until the callback returns falsey for an elementwithout(array, itemToRemove)
: returns new array without specified item