1.0.1 • Published 1 year ago

@cchand-npm/lotide v1.0.1

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 @cchand-npm/lotide

Require it:

const _ = require('@cchand-npm/lotide');

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(...): prints a positive or negative assertion depending on whether two arrays are equal in type and value
  • assertEqual(...): prints a positive or negative assertion depending on whether the actual output of a function and the expected output are equal in type and value
  • assertObjectsEqual(...): prints a positive or negative assertion depending on whether two objects are equal in type and value
  • countLetters(...): counts the frequency of each letter in a phrase
  • countOnly(...): counts the frequency of a given element, or group of elements
  • eqArrays(...): compares two arrays to determine if they are equal in type and value
  • eqObjects(...): compares two objects to determine if they are equal in type and value
  • findKey(...): returns the first property in an object that matches a given input
  • findKeyByValue(...): returns the key of a given value
  • head(...): returns the first element of an array
  • letterPositions(...): returns the index of a given letter and its duplicates in a phrase
  • map(...): uses a callback function to manipulate the elements in an array
  • middle(...): returns the middle element of an array (if odd) or the middle two elements (if even)
  • tail(...): removes the first element of an array
  • takeUntil(...): uses a callback function to return the elements of an array until an element meets a given condition
  • without(...): returns an array with a given set of elements excluded