@cjepps/lotide

lotide project Lighthouse Labs

Usage no npm install needed!

<script type="module">
  import cjeppsLotide from 'https://cdn.skypack.dev/@cjepps/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 @username/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(...): Checks if two arrays are equal
  • assertEqual(...): assert if output of function matches expected output
  • assertObjectsEqual(...): asserts to objects are equal
  • countLetters(...): count occurances of letters in a string
  • countOnly(...): count occurances of an item if it matches an item in an object
  • eqArrays(...): Checks if two arrays are equal
  • eqObjects(...): checks if both objects have identical keys with identical values.
  • findKey(...): return the 1st key for which the callback returns truthy
  • findKeyByValue(...): return the 1st key with the value
  • head(...): return the 1st element in an array
  • letterPositions(...): return all the indices in the string where each character is found
  • map(...): return a new array based on the results of the callback function
  • middle(...): returns the elements at the middle of an array
  • tail(...): returns all elements in an array except the 1st one
  • takeUntil(...): return a "slice of the array with elements taken from the beginning." It should keep going until the callback/predicate returns a truthy value
  • without(...): return a subset of a given array, removing unwanted elements