import { getValueByPath } from "@grozav/utils";
export const sameAs = (value, options) => {
  if (!options.target) {
    console.error('The "target" option must be specified for "sameAs" validator.');
    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;
};
