1.1.1 • Published 4 years ago

@min994/lotide v1.1.1

Weekly downloads
1
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 @min994/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(array): Return first element of an array
  • tail(array): Return all but the first elements of an array
  • middle(array): Return element(s) that are indexed in the middle of an array
  • map(array): Perform specific action on each element in an array
  • letterPositions(array): Return letter position of each unique letter
  • flatten(array): Flatten multiple array into one
  • findKeyByValue(object, value): Find key by given value
  • findKey(object, callback): Scan the object and return the first key for which the callback returns a truthy value. If no key is found, then it should return undefined.
  • eqObjects(object1, object2): Returns true if both objects have identical keys with identical values
  • eqArrays(array1, array2): Returns true if both arrays have identical values
  • countOnly(array, object): Count only when given object's value is true
  • countLetters(sentence): Count letters and return count in an object
  • assertObjectsEqual(object1, object2): Returns true if both objects have identical keys with identical values
  • assertEqual(actual, expected): Verify if result is the same as expected
  • assertArraysEqual(array1, array2): Returns true if both arrays have identical values
  • takeUntil(array, callback) : The function will return a slice of the array with elements taken from the beginning. It should keep going until the callback/predicate returns a truthy value
  • without(array1, array2): Return elements in array1 that are not included in array2