1.0.0 • Published 4 years ago

@seanchughes/lotide v1.0.0

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArrayEqual(arr1, arr2): Makes sure array's equal eachother.
  • assertEqual(arr1, arr2): Returns true or false depending on whether primitive values are equal.
  • AssertObjectsEqual(obj1, obj2): Makes sure objects are equal.
  • eqObjects(obj1, obj2): Returns true or false depending on whether objects are equal.
  • countLetters(string): Counts the amount of letters within a string.
  • countOnly(arr): Counts the items within an array.
  • eqArrays(arr1, arr2): Returns true or false depending on whether arrays match.
  • findKey(object, callback): Finds key give an object and a callback function.
  • findKeyByValue(object, value): Finds the key given the value of the key.
  • head(arr): Returns the first item within an array.
  • letterPositions(string): Returns an object with the letters and index of where the letters are located.
  • map(arr, callback): Returns an array of items that meet the callbacks requirement.
  • middle(arr): Returns the middle value of an array.
  • tail(arr): Returns all items in an array except for the first one.
  • takeUntil(arr, callback): Returns all items in an array untill the callback function returns a truthy value.
  • without(arr, itemToRemove): Returns an array without the values of itemToRemove.