1.0.0 • Published 5 years ago

@drystar/lotide v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
5 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, Vancouver, BC, Canada.

Usage

Install it:

npm install @drystar/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(actual, expected); Check if two arrays are strictly equal
  • assertEqual(actual, expected); Check if two elements are strictly equal
  • assertEqualObjects(actual, expected); Check if two objects are strictly equal
  • countLetters(actual, expected); Returns an object with key = letter in a string, value = number of times it appears in a string
  • countOnly(actual, expected); Returns an object with a key = element in itemsToCount, value = number of times it appears in all items
  • eqArrays(actual, expected); Determines if two arrays are strictly equal
  • eqObjects(actual, expected); Determines if two objects are strictly equal
  • findKey(actual, expected); Finds an input key in an object
  • findKeyByValue(actual, expected); Finds a key from an input value in an object
  • flatten(actual, expected); Returns a new array with all subelements concatenated
  • head(actual, expected); Returns the first element of an array
  • index(actual, expected); index of this library
  • letterPositions(actual, expected); Returns an object with the indicies at which the characters appear in a string
  • map(actual, expected); Returns a new array with a callback function applied to each element
  • middle(actual, expected); Returns the middle element(s) of an array
  • tail(actual, expected); Returns an array without the first element
  • takeUntil(actual, expected); Returns an array that concatenates elements of the original array until the specifed element appears
  • without(actual, expected); Returns a new array consisting of a unique elements from two array inputs