@chrischoi96/lotide

A lotide library developed in Lighthouse Labs Weeks 1 - 2. Meant for learning purposes only.

Usage no npm install needed!

<script type="module">
  import chrischoi96Lotide from 'https://cdn.skypack.dev/@chrischoi96/lotide';
</script>

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(...): Prints if two arrays are strictly equal.
  • assertEqual(...): Prints if two elements are strictly equal.
  • assertObjectsEqual(...): Prints if two objects are strictly equal.
  • countLetters(...): Returns an object with key = letter in a string, value = number of times it appears in a string.
  • countOnly(...): Returns an object with a key = element in itemsToCount, value = number of times it appears in allItems.
  • eqArrays(...): Determines if two arrays are strictly equal.
  • eqObjects(...): Determines if two objects are strictly equal.
  • findKey(...): Finds a input key in an object.
  • findKeyByValue(...): Finds a key from an input value in object.
  • flatten(...): Returns a new array with all subelements concatenated.
  • head(...): Returns the first element of an array.
  • letterPositions(...): Returns an object with the indices the characters of a string appear in the string.
  • map(...): Returns a new array with a callback function applied to each element.
  • middle(...): Returns the middle element(s) of an array.
  • tail(...): Returns an array without the first element.
  • takeUntil(...): Returns an array that concatenates elements of the original array until the specified element appears.
  • without(...): Returns a new array consisting of unique elements from two input arrays.