1.0.0 • Published 1 year ago

@ethanw03/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year 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 @ethanw03/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArrayEquals(arr1, arr2): console logs whether two arrays are equal
  • assertEqual(actual, expected): console logs whether two inputs are equal
  • assertObjectEqual(actual, expected): console logs whether two objects are equal
  • countLetters(sentence): counts the total amount of letters in a sentence and console logs the amount of the letter most used
  • countOnly(allItems, itemsToCount): counts the amount of times the item appears in the object.
  • eqArrays(arr1, arr2): checks to see if two arrays are equal
  • eqObjects(object1, object2): checks to see if two objects are equal.
  • findKey(object, callback): returns the key of the value outputted from the callback function
  • keyByValue(object, value): returns the corresponding key from the value.
  • head(arr): returns the first element of a given array
  • letterPositions(sentence): returns the index position(s) of a letter within a string
  • map(array, callback): returns the letter at a certain index for each word in a string
  • middle(array): returns the middle index(s) of an array
  • tail(arr): returns the array without it's first value
  • takeUntil(array, callback): returns the array up until the condition of the callback function is satisfied
  • without(source, itemsToRemove): removes an item from the array and returns the array without the given item