@inkline/inkline
Version:
Inkline is the Vue.js UI/UX Library built for creating your next design system
16 lines (11 loc) • 427 B
text/typescript
import { getValueByPath } from '@inkline/inkline/helpers';
export function sameAs (value: any, options: any = {}) {
if (!options.target) {
return false;
}
const targetSchema = 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;
}