1.0.0 • Published 2 years ago
@rofiat/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 @rofiat/lotide
Require it:
const _ = require('@rofiat/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArrayEqual
: This function asserts if two arrays are equalsassertEqual
: This function asserts if two values are equalassertObjectEqual
: This function asserts if two objects are equalcountLetters
: This function accepts a string and returns the count for each letter of a string and the number of times it occuredcountonly
: This function accepts an array of strings and return counts for a subset of those stringeqArrays
: This function accepts two arrays and returns true or false based on their equalityeqObjects
: This function accepts two objects and returns true or false based on their equalityfindKey
: This function accepts an object and a callback function and returns the first key that is a truthyfindKeyByValue
: This function accepts an object and a value and returns the first key that contains a given valuehead
: This function finds and returns the first element in an arrayindex
: This is an object with list of all the functions contained in this projectletterPositions
: This function accepts a string and returns an object with all the indices in the string where each character was foundmap
: This function accepts an array and a callback function, it returns a new array with the results of calling the provided callback function on each element in the input arraymiddle
: This function finds and returns the middle element in an arraypig-latin
: This function turns an english word to pig latin by adding 'ay' at the end of each stringreverse
: This function takes in a string and return the retun form of the stringtail
: This function finds and returns the tail/end element in an arraytakeUntil
: This function accepts an array and a callback function and runs each array element through the function, it returns an array with all the items from the original array until the callback provided returns a truthy valuewithout
: This function removes elements from an array
1.0.0
2 years ago