1.0.0 • Published 2 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(array1, array2): Checks if the two arrays are the same and returns a string.
  • assertEqual(actual, expected): Checks if the actually and expected value are the same.
  • assertObjectsEqual(actual, expected): Checks if both objects have identical objects.
  • countLetters(words): Counts how many instances that a letter occurs.
  • countOnly(allItems, itemsToCount): Counts value if provided true and returns the total amount that occurs.
  • eqArrays(array1, array2): Checks if two arrays are the same.
  • eqObjects(object1, object2): Checks if the key and values are the same.
  • findKey(object, callback): Return the key of the first value that matches the callback.
  • findKeyByValue(genre, show): Provide show and it will return genre unless its not on the list.
  • flatten(array):Returns an array of arrays into one single array.
  • head(array): Returns index 0
  • letterPosition(setence): Tells you the index in which that letter appears.
  • map(array, callback): Takes an array and returns the callback of the array.
  • middle(array): Returns the middle value if odd, returns two values if even.
  • tail(array): Returns an array at index 1
  • takeUntil(array, callback): take from the array until it reachs the callback.
  • withOut(array1, array2): Compares two arrays if they have the same value they will be removed.