Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bc2849

Browse files
[Types] rename _getError by _getErrorInvalidValue
1 parent a171e42 commit 8bc2849

21 files changed

Lines changed: 32 additions & 53 deletions

dist/routes/Route.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ var Route = (_temp = _class = function () {
156156
*/
157157

158158
this.koaRouter = new _koaRouter3.default();
159-
/**
160-
* @ignore
161-
*/
162-
this.privateKeyInParamsRoute = ['__force', '__func'];
163159
// This Variable are set by RouteDecorators
164160
this.routes;
165161
this.routeBase;

dist/types/TypeAny.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ var _createClass2 = require('babel-runtime/helpers/createClass');
3737

3838
var _createClass3 = _interopRequireDefault(_createClass2);
3939

40-
var _i18n = require('i18n-2');
40+
var _i18n2 = require('i18n-2');
4141

42-
var _i18n2 = _interopRequireDefault(_i18n);
42+
var _i18n3 = _interopRequireDefault(_i18n2);
4343

4444
var _path = require('path');
4545

@@ -77,15 +77,17 @@ var TypeAny = exports.TypeAny = function () {
7777
}), (0, _defineProperty3.default)(_errorMessages, this._TypeError.INVALID_TYPE, function () {
7878
return _this._i18n.__('Expected type %s', _this._type);
7979
}), (0, _defineProperty3.default)(_errorMessages, this._TypeError.INVALID_VALUE, function () {
80-
return _this._i18n.__('Invalid field');
80+
return _this._getErrorInvalidValue.apply(_this, arguments);
8181
}), _errorMessages);
8282
this._isRequired = false;
8383
this._notNull = false;
8484
this._default = undefined;
8585
this._value = null;
8686

87-
this._getError = function () {
88-
return _this._i18n.__('Invalid field');
87+
this._getErrorInvalidValue = function (_ref2) {
88+
var _i18n = _ref2._i18n;
89+
90+
return _i18n.__('Invalid field');
8991
};
9092

9193
this._getDescription = function () {
@@ -100,14 +102,14 @@ var TypeAny = exports.TypeAny = function () {
100102
locales: ['en', 'fr'],
101103
extension: '.json'
102104
}, i18n);
103-
this._i18n = new _i18n2.default(this._i18nConfig);
105+
this._i18n = new _i18n3.default(this._i18nConfig);
104106
}
105107

106108
(0, _createClass3.default)(TypeAny, [{
107109
key: 'clone',
108110
value: function clone() {
109111
var clone = (0, _assign2.default)((0, _create2.default)((0, _getPrototypeOf2.default)(this)), this);
110-
clone._i18n = new _i18n2.default(this._i18nConfig);
112+
clone._i18n = new _i18n3.default(this._i18nConfig);
111113
return clone;
112114
}
113115
}, {

dist/types/TypeArray.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var TypeArray = function (_TypeAny) {
4949

5050
_this._tSingle = false;
5151

52-
_this._getError = function (_ref, key) {
52+
_this._getErrorInvalidValue = function (_ref, key) {
5353
var _i18n = _ref._i18n;
5454

5555
if (key === 'type') return _i18n.__('Should be an array');
@@ -81,8 +81,7 @@ var TypeArray = function (_TypeAny) {
8181
return '' + msgError + paramMsg + '.';
8282
};
8383

84-
_this._errorMessages[_this._TypeError.INVALID_VALUE] = _this._getError;
85-
_this._errorMessages[_this._TypeError.INVALID_TYPE] = _this._getError;
84+
_this._errorMessages[_this._TypeError.INVALID_TYPE] = _this._getErrorInvalidValue;
8685
return _this;
8786
} // the array's maximum allowed length
8887
// the array's exact allowed length

dist/types/TypeBinary.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var TypeBinary = function (_TypeAny) {
4949

5050
var _this = (0, _possibleConstructorReturn3.default)(this, (TypeBinary.__proto__ || (0, _getPrototypeOf2.default)(TypeBinary)).call(this, (0, _extends3.default)({}, params, { type: 'binary' })));
5151

52-
_this._getError = function (_ref, key) {
52+
_this._getErrorInvalidValue = function (_ref, key) {
5353
var _i18n = _ref._i18n;
5454

5555
key = _this._errorKey || key;
@@ -80,7 +80,6 @@ var TypeBinary = function (_TypeAny) {
8080
return '' + msgError + paramMsg + '.';
8181
};
8282

83-
_this._errorMessages[_this._TypeError.INVALID_VALUE] = _this._getError;
8483
return _this;
8584
} // the buffer's minimum allowed length
8685
// the desired encoding of buffer

dist/types/TypeBoolean.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var TypeBoolean = exports.TypeBoolean = function (_TypeAny) {
5959
_this._falsyValues = ['false'];
6060
_this._insensitive = true;
6161

62-
_this._getError = function (_ref) {
62+
_this._getErrorInvalidValue = function (_ref) {
6363
var _i18n = _ref._i18n;
6464

6565
return _i18n.__('Should be a boolean');
@@ -72,7 +72,6 @@ var TypeBoolean = exports.TypeBoolean = function (_TypeAny) {
7272
return prefix + 'a boolean or one of: (' + _utils.utils.joinWithCote(valideValue, ', ') + ').';
7373
};
7474

75-
_this._errorMessages[_this._TypeError.INVALID_VALUE] = _this._getError;
7675
return _this;
7776
} // Specifies additional values to be considered as 'falsy'
7877

dist/types/TypeDate.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var TypeDate = function (_TypeAny) {
5353

5454
var _this = (0, _possibleConstructorReturn3.default)(this, (TypeDate.__proto__ || (0, _getPrototypeOf2.default)(TypeDate)).call(this, (0, _extends3.default)({}, params, { type: 'date' })));
5555

56-
_this._getError = function (_ref, key) {
56+
_this._getErrorInvalidValue = function (_ref, key) {
5757
var _i18n = _ref._i18n,
5858
_max = _ref._max,
5959
_min = _ref._min;
@@ -85,7 +85,6 @@ var TypeDate = function (_TypeAny) {
8585
return '' + msgError + paramMsg + '.';
8686
};
8787

88-
_this._errorMessages[_this._TypeError.INVALID_VALUE] = _this._getError;
8988
return _this;
9089
} // earliest possible date
9190
// the date's input format

dist/types/TypeEnum.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var TypeEnum = exports.TypeEnum = function (_TypeAny) {
5656
_this._insensitive = true;
5757
_this._number = true;
5858

59-
_this._getError = function (_ref) {
59+
_this._getErrorInvalidValue = function (_ref) {
6060
var _i18n = _ref._i18n;
6161

6262
return _i18n.__('Should be one of %s', _utils.utils.joinWithCote(_this._oneOf, ', '));
@@ -68,7 +68,6 @@ var TypeEnum = exports.TypeEnum = function (_TypeAny) {
6868
return prefix + 'one of: (' + _utils.utils.joinWithCote(_this._oneOf, ', ') + ').';
6969
};
7070

71-
_this._errorMessages[_this._TypeError.INVALID_VALUE] = _this._getError;
7271
return _this;
7372
}
7473

dist/types/TypeNumber.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var TypeNumber = exports.TypeNumber = function (_TypeAny) {
5555
_this._positive = false;
5656
_this._negative = false;
5757

58-
_this._getError = function (_ref, key) {
58+
_this._getErrorInvalidValue = function (_ref, key) {
5959
var _i18n = _ref._i18n;
6060

6161
key = _this._errorKey || key;
@@ -112,7 +112,6 @@ var TypeNumber = exports.TypeNumber = function (_TypeAny) {
112112
return Math[type](nb * Math.pow(10, nbDigit)) / Math.pow(10, nbDigit);
113113
};
114114

115-
_this._errorMessages[_this._TypeError.INVALID_VALUE] = _this._getError;
116115
return _this;
117116
} // Specifies the maximum number of decimal places where:
118117
// Requires the number to be positive.

dist/types/TypeObject.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var TypeObject = exports.TypeObject = function (_TypeAny) {
5353
_this._schema = {};
5454
_this._errors = {};
5555

56-
_this._getError = function (_ref, key, keyError, msg) {
56+
_this._getErrorInvalidValue = function (_ref, key, keyError, msg) {
5757
var _i18n = _ref._i18n;
5858

5959
if (key === 'add') return _this._errorWithKey ? keyError + ': ' + msg : msg;
@@ -66,7 +66,6 @@ var TypeObject = exports.TypeObject = function (_TypeAny) {
6666
return prefix + 'an object';
6767
};
6868

69-
_this._errorMessages[_this._TypeError.INVALID_VALUE] = _this._getError;
7069
return _this;
7170
}
7271

dist/types/TypeOneOf.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var TypeOneOf = exports.TypeOneOf = function (_TypeAny) {
4949
_this._types = [];
5050
_this._errors = [];
5151

52-
_this._getError = function (_ref) {
52+
_this._getErrorInvalidValue = function (_ref) {
5353
var _i18n = _ref._i18n;
5454

5555
return _i18n.__('Invalid type');
@@ -88,7 +88,6 @@ var TypeOneOf = exports.TypeOneOf = function (_TypeAny) {
8888
return prefix + 'either ' + msgs.join(' OR ') + '.';
8989
};
9090

91-
_this._errorMessages[_this._TypeError.INVALID_VALUE] = _this._getError;
9291
return _this;
9392
}
9493

0 commit comments

Comments
 (0)