1.0.0 • Published 1 year ago

@wesleymatthee/lotidetwo v1.0.0

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 @wesleymatthee/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(...): Returns the first element in an array

  • tail(...): Removes the first element in an array

  • middle(...): Middle returns the two middle elements of an even array and the middle elememt of an odd array. If the array is >3 it returns empty

  • assertArraysEqual(...): It checks if two given arrays are equal

  • assertEqual(...): It checks if two given arguments are equal

  • assertObjectsEqual(...): //It checks if eqObjects are equal and the logs if truthy of falsy

  • countLetters(...): It counst the letter in a string

  • eqArrays(...): It checks if two given arrays are equal

  • eqObjects(...): It checks if two given objects are equal

  • findKey(...): It returns the first key for which the callback returns a truthy value.

  • findKeyByValue(...): It returns the value of the matching key

  • letterPositions(...): It iterates through an object then assigns a key number and an empty array for value if the key is undefined.

  • map(...): Using a callback to map new items or an array.

  • takeUntil(...): It iterates through an array and uses a callback to check if a conditon is met. If it is then it returns a new array

  • without(...): If the index in the array matches the argument it is removed and a new array is made with the remainder.