import { ref, string } from 'yup' export const passwordConfirmationRule = string() .required() .oneOf([ref('password')], 'تکرار رمزعبور با رمزعبور یکسان نیست') export const optionalPasswordConfirmationRule = string() .nullable() .notRequired() .test('match', 'تکرار رمزعبور با رمزعبور یکسان نیست', function (value) { const pw = this.parent.password if (!pw && !value) return true return value === pw })