Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: add alternative to fluent rule api that enables creating rules from data - 363 #443

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ npm-debug.log*
.test
dist/doc-temp
dist/test
*.bak
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"lint": "cross-env tslint --project tsconfig.json",
"pretest": "cross-env npm run lint",
"test": "cross-env rimraf dist && tsc && karma start --single-run",
"develop": "concurrently \"./node_modules/.bin/tsc --watch\" \"./node_modules/.bin/karma start\"",
"develop": "concurrently \"tsc --watch\" \"karma start\"",
"prebuild:amd": "cross-env rimraf dist/amd",
"build:amd": "cross-env tsc --project tsconfig.build.json --outDir dist/amd --module amd",
"postbuild:amd": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/amd",
Expand Down
2 changes: 1 addition & 1 deletion src/implementation/standard-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class StandardValidator extends Validator {
}

// any rules?
if (!rules) {
if (!rules || (rules.length === 0)) {
return Promise.resolve([]);
}

Expand Down
6 changes: 1 addition & 5 deletions src/implementation/validation-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ export class ValidationMessageProvider {
*/
public getMessage(key: string): Expression {
let message: string;
if (key in validationMessages) {
message = validationMessages[key];
} else {
message = validationMessages['default'];
}
message = (key in validationMessages) ? validationMessages[key] : validationMessages['default'];
return this.parser.parse(message);
}

Expand Down
Loading