You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
307 B

3 months ago
  1. 'use strict';
  2. const AssertError = require('./error');
  3. const internals = {};
  4. module.exports = function (condition, ...args) {
  5. if (condition) {
  6. return;
  7. }
  8. if (args.length === 1 &&
  9. args[0] instanceof Error) {
  10. throw args[0];
  11. }
  12. throw new AssertError(args);
  13. };