包详细信息

@bemoje/expected-got

bemoje53MIT不推荐使用1.0.1

Package is not maintained.

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

creates, error-message, string, ansi-colors

自述文件

@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).