Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Commit

Permalink
Fix #19, it causes by the function name changed in production again d…
Browse files Browse the repository at this point in the history
…ue to the uglify.
  • Loading branch information
Albert-Gao committed Dec 12, 2017
1 parent 0e0bc19 commit 5bbaf71
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,12 @@ function extractUserDefinedMsg(handlerName, schema) {
return result;
}

function ruleRunner(ruleHandler, fieldName, value, pschema) {
function ruleRunner(ruleName, ruleHandler, fieldName, value, pschema) {
const { schema, userErrorText } = extractUserDefinedMsg(
ruleHandler.name,
ruleName,
pschema
);

const ruleName = ruleHandler.name;

if (RuleWhichNeedsBoolean.includes(ruleName)) {
if (schema[ruleName] === false) return;
}
Expand Down Expand Up @@ -280,7 +278,13 @@ function runMatchers(matcher, fieldState, fieldSchema) {
const schema = fieldSchema[fieldName];
Object.keys(schema).forEach(ruleInSchema => {
if (is.propertyDefined(matcher, ruleInSchema)) {
ruleRunner(matcher[ruleInSchema], fieldName, fieldState.value, schema);
ruleRunner(
ruleInSchema,
matcher[ruleInSchema],
fieldName,
fieldState.value,
schema
);
}
// TODO: Do something when the rule is not match
// else if (ruleInSchema !== 'default') {
Expand Down

0 comments on commit 5bbaf71

Please sign in to comment.