1.0.3 • Published 2 years ago

@chunloy/lotide v1.0.3

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(arrayOne, arrayTwo): Checks if two arrays are the same and prints a message.
  • assertEqual(actual, expected): Checks that a value is strictly equal to an expected value.
  • assertObjectsEqual(actual, expected): Checks that two objects are equal.
  • countLetters(string): Returns a count of all letters from a string.
  • countOnly(array, object): Takes in a collection of items and returns a count for a specified subset of items.
  • eqArrays(actual, expected): Checks that two arrays equal by comparing each element.
  • eqObjects(object1, object2): Checks that two objects are equal by comparing key-value pairs.
  • findKey(object, callback): Returns the key belonging to the object when the callback is true.
  • findKeyByValue(object, value): Returns the key of an object by its value.
  • fatten(array): Returns a flattened version of a nested array. Original array is preserved.
  • head(array): Returns the first value of an array. Original array is preserved.
  • letterPositions(string): Returns the indices corresponding to each letter in a string.
  • map(array, callback): Returns a transformed array as specified by the callback.
  • middle(array): Returns the middle value of an array. If even, the two middle most values are returned. Original array is preserved.
  • tail(array): Returns the tail of an array. Original array is preserved.
  • takeUntil(array, callback): Returns the collection of items from an array until the callback is true.
  • without(arrayOne, arrayTwo): Returns a filtered array from a specified list. Original array is preserved.
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago