@@ -74,7 +74,7 @@ exports.validateRemoteMethodName = function(name) {
74
74
return 'Name cannot contain "." characters except' +
75
75
' the dot in "prototype." prefix' ;
76
76
}
77
- var result = exports . validateOptionalName ( name , / [ \/ @ \s \+ % : ] / ) ;
77
+ var result = validateValue ( name , / [ \/ @ \s \+ % : ] / ) ;
78
78
if ( result !== true ) return result ;
79
79
if ( RESERVED_PROPERTY_NAMES . indexOf ( name ) !== - 1 ) {
80
80
return name + ' is a reserved keyword. Please use another name' ;
@@ -92,7 +92,7 @@ exports.validateRequiredName = function (name) {
92
92
if ( ! name ) {
93
93
return 'Name is required' ;
94
94
}
95
- return exports . validateOptionalName ( name ) ;
95
+ return validateValue ( name , / [ \/ @ \s \+ % : \. ] / ) ;
96
96
} ;
97
97
98
98
/**
@@ -101,7 +101,11 @@ exports.validateRequiredName = function (name) {
101
101
* @param {String } name The user input
102
102
* @returns {String|Boolean }
103
103
*/
104
- exports . validateOptionalName = function ( name , unallowedCharacters ) {
104
+ exports . validateOptionalName = function ( name ) {
105
+ return validateValue ( name , / [ \/ @ \s \+ % : \. ] / ) ;
106
+ } ;
107
+
108
+ function validateValue ( name , unallowedCharacters ) {
105
109
if ( ! unallowedCharacters ) {
106
110
unallowedCharacters = / [ \/ @ \s \+ % : \. ] / ;
107
111
}
@@ -114,7 +118,7 @@ exports.validateOptionalName = function (name, unallowedCharacters) {
114
118
'encodeURIComponent: ' + name ;
115
119
}
116
120
return true ;
117
- } ;
121
+ }
118
122
119
123
/**
120
124
* Check if relation has a different name from properties
0 commit comments