@nodecg/json-schema-lib
Version:
Extensible JSON Schema library with support for multi-file schemas using $ref
21 lines (16 loc) • 454 B
JavaScript
;
var ono = require('ono');
var typeOf = require('../../util/typeOf');
module.exports = validatePlugin;
/**
* Ensures that a user-supplied value is a valid plugin POJO.
* An error is thrown if the value is invalid.
*
* @param {*} plugin - The user-supplied value to validate
*/
function validatePlugin (plugin) {
var type = typeOf(plugin);
if (!type.isPOJO) {
throw ono('Invalid arguments. Expected a plugin object.');
}
}