@inkline/inkline
Version:
Inkline is the intuitive UI Components library that gives you a developer-friendly foundation for building high-quality, accessible, and customizable Vue.js 3 Design Systems.
19 lines (18 loc) • 587 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.sameAs = void 0;
var _utils = require("@grozav/utils");
const sameAs = (value, options) => {
if (!options.target) {
console.error('The "target" option must be specified for "sameAs" validator.');
return false;
}
const targetSchema = (0, _utils.getValueByPath)(options.schema, options.target);
if (!targetSchema) {
throw new Error(`Could not find target with name '${options.target}' in 'sameAs' validator.`);
}
return value === targetSchema.value;
};
exports.sameAs = sameAs;