Updated argument of validator function to be optional.

This commit is contained in:
deskoh
2019-01-10 17:53:31 +08:00
parent e836acc75a
commit be2a0cdc91
2 changed files with 8 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/aldeed/simple-schema-js
// Definitions by: Andreas Richter <https://github.com/arichter83>
// Qkramer <https://github.com/Qkramer>
// Deskoh <https://github.com/deskoh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface ValidationContext extends SimpleSchemaValidationContextStatic {
@@ -133,7 +134,7 @@ interface SimpleSchemaStatic {
newContext(): ValidationContext;
objectKeys(keyPrefix: any): any[];
validate(obj: any, options?: ValidationOption): void;
validator(options: ValidationOption): () => boolean;
validator(options?: ValidationOption): () => boolean;
RegEx: {
Email: RegExp;
EmailWithTLD: RegExp;

View File

@@ -35,6 +35,12 @@ StringSchema.validate({
regExpString: "id"
}, {keys: ['basicString']});
StringSchema.validator();
StringSchema.validator({
clean: true
});
const StringSchemaWithOptions = new SimpleSchema({
basicString: {
type: String