fediversity.eu/node_modules/@hapi/hoek/lib/assert.js

23 lines
307 B
JavaScript
Raw Permalink Normal View History

2024-03-26 16:28:28 +01:00
'use strict';
const AssertError = require('./error');
const internals = {};
module.exports = function (condition, ...args) {
if (condition) {
return;
}
if (args.length === 1 &&
args[0] instanceof Error) {
throw args[0];
}
throw new AssertError(args);
};