1.0.0 • Published 4 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(arr, arr2): Assertions for comparing two array values for equality.
  • assertEqual(actual, expected): Assertions for comparing two non-array values for equality.
  • assertObjectsEqual(arr, arr2): Assertions for comparing two objects for equality.
  • countLetters(str): Returns an object containing the count of each character in a string.
  • countOnly(allItems, itemsToCount): Returns an object containing the count of a given character in a string.
  • eqArays(arr, arr2): Checks if two given arrays are equal.
  • eqObject(object1, object@): Checks if two given objects are equal.
  • findKey(object, callback): Returns the key of given value.
  • findKeyByValue(obj, value): Returns the key of given value.
  • head(arr): Returns the head of an array.
  • letterPositions(sentence): Returns an object with key/value pairs containing the positions of each character in a given string.
  • map(array, callback): Clone of .map() array method. Returns a new array.
  • middle(arr): Returns a subset containing the middle element(s) of a given array.
  • tail(arr): Returns the tail of a given array.
  • takeUntil(array, callback): Returns a slice of the array with elements taken from the beginning.
  • without(source, itemsToRemove): Returns a new array without specified values.