1.0.0 • Published 7 months ago

@handsomepeasant/lotide v1.0.0

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(): returns the first element of an array
  • tail(): returns all elements of an array except the first
  • middle(): returns the middle element(s) of an array
  • assertEqual(): compares two inputs and prints pass or fail message
  • assertArraysEqual(): checks if two arrays are identical and prints a pass or fail message
  • assertObjectsEqual(): checks if two objects are identical and prints pass or fail
  • eqArrays(): function used by assertArraysEqual() to check values of arrays
  • eqObjects(): function used by assertObjectsEqual() to check values of objects
  • countLetters(): returns an object where each key-value pair is a letter that appears in the passed-in string & how many times it appears
  • countOnly(): receives an array and an object that determines which items in the array will be counted
  • findKey(): receives an object and a callback value, scans the object and returns the first key for which the callback returns a truthy value
  • findKeyByValue(): simplified version of findKey()
  • letterPositions(): returns all indices where each character in a string is found
  • takeUntil(): returns items from a passed-in array until the specified callback returns a truthy value
  • without(): takes in two arrays and returns a new array that does not include any items included in itemsToRemove
1.0.0

7 months ago