1.0.2 • Published 5 years ago
@kguertin/lotide v1.0.2
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 @kguertin/lotide
Require it:
const _ = require('@kguertin/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(array)
: A function for checking if two arrays are equal based on expected value provided by user.assertEqual(string)
: A function to check if a function returns an expected value that the user defines.assertObjectsEqual(object)
: A function for checking if two given objects are equal based on an expected value provided by user.countLetters(string)
: A function for counting the number of letters in a given string.countOnly(string)
: A function for counting the number of times a given string appears in an array.'eqArrays(array)
: A function for checking if an array is equal when measured against another array.eqObjects(object)
: A function for checking if an object are equal when measured against another object.findKey(object)
: A function for finding the key of an object when given a key-value pair.findKeyByValue(object)
: A function for finding the key of a given object when given its value.flatten(array)
: A function used for flattening nested arrays.head(array)
: A function used for finding the first element of an array.letterPositions(string)
: A function that shows the position of each letter in a given string.map(array)
: A function that takes in an array and returns a new array based on the conditions provided through the callback function.middle(array)
: A function that returns the middle element(s) of a passed array.tail(array)
: A function that returns all elements following the first element of an array.takeUntil(array)
: A function that takes in an array and returns the elements of that array until the specified value.without(array)
: A function that returns the given array without the specified items to remove.