1.0.0 • Published 4 years ago

@joanlai2021/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 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 @joanlai2021/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(...): return the first item in the array
  • tail(...): return the array excluding the first item
  • middle(...): return the middle item(s) of the array
  • assertArraysEqual(...): console the assertion result of whether actual array is equal to the expected array.
  • assertEqual(...): console the assertion result of whether actual result is equal to the expected result.
  • eqArrays(...): to compare if 2 arrays are equal.
  • assertObjectsEqual(...): console the assertion result of whether actual object is equal to the expected object.
  • eqObjects(...): to compare if 2 objects are equal.
  • countLetters(...): to count how many times a letter appeared in the object.
  • countOnly(...): to count only items within an object that is passed on as true.
  • findKey(...): to find key in an object
  • findKeyByValue(...): to find the key in an object by the key's value.
  • letterPositions(...): to print out the index of the given letter within the given object.
  • map(...): creates a new array populated with the results of calling a provided function on every item in the calling array.
  • takeUntil(...): to print items from the calling array until the specified item in the array appeared, and ceased printing the rest of the items in the calling array.
  • without(...): to remove an item from the calling array.