vue-ts-types
Version:
Lightweight TypeScript-first Vue prop type definitions
12 lines (11 loc) • 389 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.isInstanceOf = void 0;
/** Validator that only allows instances of the given parent. */
const isInstanceOf = (parent) => (value) => {
if (!(value instanceof parent)) {
return `value should be an instance of ${parent.name}`;
}
return undefined;
};
exports.isInstanceOf = isInstanceOf;
;