Skip to content

Commit 2bf17ed

Browse files
chore(all): prepare release 1.2.0
1 parent 1503857 commit 2bf17ed

File tree

76 files changed

+143
-85
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+143
-85
lines changed

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aurelia-validation",
3-
"version": "1.1.3",
3+
"version": "1.2.0",
44
"description": "Validation for Aurelia applications",
55
"keywords": [
66
"aurelia",
@@ -17,7 +17,7 @@
1717
"url": "https://github.com/aurelia/validation"
1818
},
1919
"dependencies": {
20-
"aurelia-binding": "^1.7.1",
20+
"aurelia-binding": "^1.7.1 || ^2.0.0",
2121
"aurelia-metadata": "^1.0.0",
2222
"aurelia-templating": "^1.0.0"
2323
}

dist/amd/implementation/rule.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface RuleProperty {
77
/**
88
* The property name. null indicates the rule targets the object itself.
99
*/
10-
name: string | null;
10+
name: string | number | null;
1111
/**
1212
* The displayName of the property (or object).
1313
*/

dist/amd/implementation/standard-validator.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export declare class StandardValidator extends Validator {
2020
* @param rules Optional. If unspecified, the rules will be looked up using the metadata
2121
* for the object created by ValidationRules....on(class/object)
2222
*/
23-
validateProperty(object: any, propertyName: string, rules?: any): Promise<ValidateResult[]>;
23+
validateProperty(object: any, propertyName: string | number, rules?: any): Promise<ValidateResult[]>;
2424
/**
2525
* Validates all rules for specified object and it's properties.
2626
* @param object The object to validate.

dist/amd/implementation/standard-validator.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ define(["require", "exports", "aurelia-templating", "../validator", "../validate
8787
var _loop_1 = function (i) {
8888
var rule = rules[i];
8989
// is the rule related to the property we're validating.
90-
if (!validateAllProperties && rule.property.name !== propertyName) {
90+
// tslint:disable-next-line:triple-equals | Use loose equality for property keys
91+
if (!validateAllProperties && rule.property.name != propertyName) {
9192
return "continue";
9293
}
9394
// is this a conditional rule? is the condition met?

dist/amd/implementation/validation-messages.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export declare const validationMessages: ValidationMessages;
1111
* Retrieves validation messages and property display names.
1212
*/
1313
export declare class ValidationMessageProvider {
14-
private parser;
14+
parser: ValidationMessageParser;
1515
static inject: (typeof ValidationMessageParser)[];
1616
constructor(parser: ValidationMessageParser);
1717
/**
@@ -25,5 +25,5 @@ export declare class ValidationMessageProvider {
2525
* Override this with your own custom logic.
2626
* @param propertyName The property name.
2727
*/
28-
getDisplayName(propertyName: string, displayName?: string | null | (() => string)): string;
28+
getDisplayName(propertyName: string | number, displayName?: string | null | (() => string)): string;
2929
}

dist/amd/implementation/validation-messages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ define(["require", "exports", "./validation-message-parser"], function (require,
5050
return (displayName instanceof Function) ? displayName() : displayName;
5151
}
5252
// split on upper-case letters.
53-
var words = propertyName.split(/(?=[A-Z])/).join(' ');
53+
var words = propertyName.toString().split(/(?=[A-Z])/).join(' ');
5454
// capitalize first letter.
5555
return words.charAt(0).toUpperCase() + words.slice(1);
5656
};

dist/amd/implementation/validation-rules.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export declare class FluentEnsure<TObject> {
202202
* @param property The property to target. Can be the property name or a property accessor
203203
* function.
204204
*/
205-
ensure<TValue>(property: string | PropertyAccessor<TObject, TValue>): FluentRules<TObject, any>;
205+
ensure<TValue>(property: string | number | PropertyAccessor<TObject, TValue>): FluentRules<TObject, any>;
206206
/**
207207
* Targets an object with validation rules.
208208
*/
@@ -225,7 +225,7 @@ export declare class ValidationRules {
225225
* Target a property with validation rules.
226226
* @param property The property to target. Can be the property name or a property accessor function.
227227
*/
228-
static ensure<TObject, TValue>(property: string | PropertyAccessor<TObject, TValue>): FluentRules<TObject, any>;
228+
static ensure<TObject, TValue>(property: string | number | PropertyAccessor<TObject, TValue>): FluentRules<TObject, any>;
229229
/**
230230
* Targets an object with validation rules.
231231
*/

dist/amd/implementation/validation-rules.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ define(["require", "exports", "./rules", "./validation-messages", "../util"], fu
364364
throw new Error("Did you forget to add \".plugin('aurelia-validation')\" to your main.js?");
365365
};
366366
FluentEnsure.prototype.mergeRules = function (fluentRules, propertyName) {
367-
var existingRules = this.rules.find(function (r) { return r.length > 0 && r[0].property.name === propertyName; });
367+
// tslint:disable-next-line:triple-equals | Use loose equality for property keys
368+
var existingRules = this.rules.find(function (r) { return r.length > 0 && r[0].property.name == propertyName; });
368369
if (existingRules) {
369370
var rule = existingRules[existingRules.length - 1];
370371
fluentRules.sequence = rule.sequence;

dist/amd/property-accessor-parser.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export declare class PropertyAccessorParser {
44
private parser;
55
static inject: (typeof Parser)[];
66
constructor(parser: Parser);
7-
parse<TObject, TValue>(property: string | PropertyAccessor<TObject, TValue>): string;
7+
parse<TObject, TValue>(property: string | number | PropertyAccessor<TObject, TValue>): string | number;
88
}
99
export declare function getAccessorExpression(fn: string): string;

dist/amd/property-accessor-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ define(["require", "exports", "aurelia-binding", "./util"], function (require, e
66
this.parser = parser;
77
}
88
PropertyAccessorParser.prototype.parse = function (property) {
9-
if (util_1.isString(property)) {
9+
if (util_1.isString(property) || util_1.isNumber(property)) {
1010
return property;
1111
}
1212
var accessorText = getAccessorExpression(property.toString());

0 commit comments

Comments
 (0)