You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
519 B
JavaScript
14 lines
519 B
JavaScript
3 years ago
|
"use strict";
|
||
|
|
||
|
const BluebirdPromise = require("bluebird");
|
||
|
const { validateValue } = require("@validatem/core");
|
||
|
const isPromise = require("./");
|
||
|
|
||
|
console.log(validateValue(new Promise(() => {}), [ isPromise ])); // Promise { <pending> }
|
||
|
console.log(validateValue(new BluebirdPromise(() => {}), [ isPromise ])); // Promise [Object] { ... }
|
||
|
|
||
|
console.log(validateValue(42, [ isPromise ])); /*
|
||
|
AggregrateValidationError: One or more validation errors occurred:
|
||
|
- At (root): Must be a Promise (Promises/A+ compliant)
|
||
|
*/
|