"use strict"; // FIXME: Package as @validatem/is-instance-of const ValidationError = require("@validatem/error"); module.exports = function isInstanceOf(constructor) { if (typeof constructor !== "function") { throw new Error(`The constructor or class to validate against, must be a function`); } return function isInstanceOf(value) { if (!(value instanceof constructor)) { throw new ValidationError(`Must be an instance of ${constructor.name}`); } }; };