@bemoje/expected-got

1.0.1 • Public • Published

@bemoje/expected-got

Creates an error-message string with ANSI-colors to make it easy to spot in the console.

Version

NPM version

Travis CI

dependencies

Dependencies

dependencies

Stats

NPM downloads Forks

Donate

Buy Me A Beer donate button PayPal donate button

Installation

npm install @bemoje/expected-got
npm install --save @bemoje/expected-got
npm install --save-dev @bemoje/expected-got

Usage

import expectedGot from '@bemoje/expected-got'

const shouldBeString = 75
const shouldBeNumberOrRegExp = 'asd'

expectedGot(String, shouldBeString)
//=> 'Expected String, got Number'

expectedGot([Number, RegExp], shouldBeNumberOrRegExp)
//=> 'Expected Number, RegExp, got String'

Tests

Uses Jest to test module functionality. Run tests to get coverage details.

npm run test

API

expectedGot

Creates an error-message string with ANSI-colors to make it easy to spot in the console.

Parameters
  • constructor function The expected type's constructor

  • value any The value argued

Returns

string The error message string (ANSI-formatted).

/@bemoje/expected-got/

    Package Sidebar

    Install

    npm i @bemoje/expected-got

    Weekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    9.14 kB

    Total Files

    5

    Last publish

    Collaborators

    • bemoje