1.0.0 • Published 2 years ago

@kel-si/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 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 @kel-si/lotide

Require it:

const _ = require('@kel-si/lotide');

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(): asserts that two arrays are equal; used with eqArrays
  • assertEqual(): asserts that two inputs are equal
  • assertObjectsEqual(): asserts two objects are equal
  • countLetters(): counts the number of letters in a given string while ignoring spaces
  • countOnly(): counts specific items
  • eqArrays(): checks if two arrays are equal (returns true or false)
  • eqObjects(): checks if two objects are equal; used with eqArrays and eqObjects
  • findKey(): find key of a given value
  • findKeyByValue(): returns the first key which contains a given value
  • head(): returns the first item in an array
  • letterPosition(): returns the index of a given letter
  • map(): returns the first letter of each string given in an array
  • middle(): returns the middle elements of an array or an empty array
  • tail(): returns everything after the first element in an array
  • takeUntil(): returns the elements in an array until it reaches a condition given
  • without(): returns an array with only elements from the source that are not present in the itemsToRemove array