1.0.0 • Published 2 years ago

@jordangm94/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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 @jordangm94/lotide

Require it:

const _ = require('@jordangm94/lotide');

Call it:

const results = _.tail([1, 2, 3]) // => [2, 3]

Documentation

The following functions are currently implemented:

head(...) Description: Retrieves the first element in an array.

tail(...) Description: Retrieves all elements besides the first element in an array.

middle(...) Description: Retrieves the middle number in an array, if array length is even, returns the two middle numbers.

assertEqual(...) Description: Compares two values to check if they are equal.

eqArrays(...) Description: Compares two arrays to check if they are equal.

assertArraysEqual(...) Description: Using eqArrays, provides a visual notice that both arrays are equal.

assertObjectsEqual(...) Description: Using eqObjects, provides a visual notice that both objects are equal.

countLetters(...) Description: Identifies all letters and counts how many of each letter is present.

countOnly(...) Description: Takes in a list of all items and counts how many items appear in the list AND are truthy.

eqObjects(...) Description: Compares two objects to check if they are equal.

findKey(...) Description: Based on a stated value, identifies the key of that stated value in the overall corresponding object.

findKeyByValue(...) Description: Receives an object of items and can identify uses value argument to identify item within object.

letterPositions(...) Description: Identifies the index of each letter in a word.

map(...) Description: Takes in two arguments: Array and callback function to act on array. I.e. Return the first letter in each word of the array: map(words, word => word0);

takeUntil(...) Description: Returns every value in an array until the specified value.

without(...) Description: Returns an array with all values excluding the one that was specified.