@impelsys/validatorjs 3.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +27 -0
- package/CONTRIBUTE.md +34 -0
- package/LICENSE +20 -0
- package/README.md +607 -0
- package/dist/lang/ar.js +66 -0
- package/dist/lang/az.js +104 -0
- package/dist/lang/be.js +105 -0
- package/dist/lang/bg.js +105 -0
- package/dist/lang/bs.js +106 -0
- package/dist/lang/ca.js +40 -0
- package/dist/lang/cs.js +107 -0
- package/dist/lang/cy.js +106 -0
- package/dist/lang/da.js +51 -0
- package/dist/lang/de.js +46 -0
- package/dist/lang/el.js +43 -0
- package/dist/lang/en.js +54 -0
- package/dist/lang/es.js +40 -0
- package/dist/lang/et.js +106 -0
- package/dist/lang/eu.js +106 -0
- package/dist/lang/fa.js +42 -0
- package/dist/lang/fi.js +51 -0
- package/dist/lang/fr.js +40 -0
- package/dist/lang/hr.js +106 -0
- package/dist/lang/hu.js +106 -0
- package/dist/lang/id.js +51 -0
- package/dist/lang/it.js +41 -0
- package/dist/lang/ja.js +54 -0
- package/dist/lang/ka.js +106 -0
- package/dist/lang/ko.js +106 -0
- package/dist/lang/lt.js +106 -0
- package/dist/lang/lv.js +106 -0
- package/dist/lang/mk.js +106 -0
- package/dist/lang/mn.js +106 -0
- package/dist/lang/ms.js +106 -0
- package/dist/lang/nb_NO.js +42 -0
- package/dist/lang/nl.js +51 -0
- package/dist/lang/pl.js +42 -0
- package/dist/lang/pt.js +110 -0
- package/dist/lang/pt_BR.js +105 -0
- package/dist/lang/ro.js +51 -0
- package/dist/lang/ru.js +40 -0
- package/dist/lang/se.js +106 -0
- package/dist/lang/sl.js +106 -0
- package/dist/lang/sq.js +106 -0
- package/dist/lang/sr.js +106 -0
- package/dist/lang/sv.js +105 -0
- package/dist/lang/tr.js +51 -0
- package/dist/lang/ua.js +40 -0
- package/dist/lang/uk.js +106 -0
- package/dist/lang/vi.js +42 -0
- package/dist/lang/zh.js +42 -0
- package/dist/lang/zh_TW.js +42 -0
- package/dist/validator.js +2183 -0
- package/package.json +78 -0
- package/src/async.js +81 -0
- package/src/attributes.js +199 -0
- package/src/errors.js +77 -0
- package/src/lang/ar.js +63 -0
- package/src/lang/az.js +101 -0
- package/src/lang/be.js +102 -0
- package/src/lang/bg.js +102 -0
- package/src/lang/bs.js +103 -0
- package/src/lang/ca.js +37 -0
- package/src/lang/cs.js +104 -0
- package/src/lang/cy.js +103 -0
- package/src/lang/da.js +48 -0
- package/src/lang/de.js +43 -0
- package/src/lang/el.js +40 -0
- package/src/lang/en.js +51 -0
- package/src/lang/es.js +37 -0
- package/src/lang/et.js +103 -0
- package/src/lang/eu.js +103 -0
- package/src/lang/fa.js +39 -0
- package/src/lang/fi.js +48 -0
- package/src/lang/fr.js +37 -0
- package/src/lang/hr.js +103 -0
- package/src/lang/hu.js +103 -0
- package/src/lang/id.js +48 -0
- package/src/lang/it.js +38 -0
- package/src/lang/ja.js +51 -0
- package/src/lang/ka.js +103 -0
- package/src/lang/ko.js +103 -0
- package/src/lang/lt.js +103 -0
- package/src/lang/lv.js +103 -0
- package/src/lang/mk.js +103 -0
- package/src/lang/mn.js +103 -0
- package/src/lang/ms.js +103 -0
- package/src/lang/nb_NO.js +39 -0
- package/src/lang/nl.js +48 -0
- package/src/lang/pl.js +39 -0
- package/src/lang/pt.js +107 -0
- package/src/lang/pt_BR.js +102 -0
- package/src/lang/ro.js +48 -0
- package/src/lang/ru.js +37 -0
- package/src/lang/se.js +47 -0
- package/src/lang/sl.js +103 -0
- package/src/lang/sq.js +103 -0
- package/src/lang/sr.js +103 -0
- package/src/lang/sv.js +102 -0
- package/src/lang/tr.js +48 -0
- package/src/lang/ua.js +37 -0
- package/src/lang/uk.js +103 -0
- package/src/lang/vi.js +39 -0
- package/src/lang/zh.js +39 -0
- package/src/lang/zh_TW.js +39 -0
- package/src/lang.js +78 -0
- package/src/messages.js +152 -0
- package/src/rules.js +864 -0
- package/src/validator.js +662 -0
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@impelsys/validatorjs",
|
|
3
|
+
"description": "Validation library inspired by Laravel's Validator",
|
|
4
|
+
"version": "3.22.2",
|
|
5
|
+
"author": "David <david@thejsguy.com>",
|
|
6
|
+
"contributors": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Mike Erickson",
|
|
9
|
+
"email": "codedungeon@gmail.com"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "Gary Green",
|
|
13
|
+
"email": "holegary@gmail.com"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "Karol Janyst",
|
|
17
|
+
"email": "lapkom@gmail.com"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"main": "./src/validator.js",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/mikeerickson/validatorjs"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/mikeerickson/validatorjs/issues?labels=bug&milestone=1&page=1&state=open"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"codedungeon",
|
|
31
|
+
"validatorjs",
|
|
32
|
+
"validator.js",
|
|
33
|
+
"data validation",
|
|
34
|
+
"validator",
|
|
35
|
+
"validate",
|
|
36
|
+
"validation",
|
|
37
|
+
"data",
|
|
38
|
+
"laravel",
|
|
39
|
+
"laravel-validator-for-js"
|
|
40
|
+
],
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"browserify": "^13.0.1",
|
|
43
|
+
"chai": "~3.5.0",
|
|
44
|
+
"eslint": "5.8.0",
|
|
45
|
+
"grunt": "1.0.4",
|
|
46
|
+
"grunt-browserify": "^5.0.0",
|
|
47
|
+
"grunt-cli": "^1.2.0",
|
|
48
|
+
"grunt-contrib-concat": "~1.0.1",
|
|
49
|
+
"grunt-contrib-watch": "~1.0.0",
|
|
50
|
+
"jit-grunt": "^0.10.0",
|
|
51
|
+
"karma": "4.3.0",
|
|
52
|
+
"karma-browserify": "6.1.0",
|
|
53
|
+
"karma-chai": "~0.1.0",
|
|
54
|
+
"karma-chrome-launcher": "3.1.0",
|
|
55
|
+
"karma-coverage": "~1.0.0",
|
|
56
|
+
"karma-growl-notifications-reporter": "0.0.2",
|
|
57
|
+
"karma-mocha": "1.3.0",
|
|
58
|
+
"karma-mocha-reporter": "2.2.5",
|
|
59
|
+
"mocha": "~2.5.3",
|
|
60
|
+
"mocha-better-spec-reporter": "github:mikeerickson/mocha-better-spec-reporter",
|
|
61
|
+
"pump": "3.0.0",
|
|
62
|
+
"puppeteer": "1.19.0",
|
|
63
|
+
"rimraf": "3.0.0"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"pre-commit": "npm run lint:spec && npm run lint && npm run test",
|
|
67
|
+
"build:all": "./scripts/build.sh",
|
|
68
|
+
"build": "rimraf dist && grunt dist",
|
|
69
|
+
"lint": "eslint \"./src/**/*.js\" --fix",
|
|
70
|
+
"lint:spec": "eslint \"./spec/**/*.js\" --rule 'no-redeclare: off'",
|
|
71
|
+
"lint:fix": "eslint \"./src/**/*.js\" --fix",
|
|
72
|
+
"test:node": "node node_modules/mocha/bin/mocha spec --slow 500 --reporter mocha-better-spec-reporter",
|
|
73
|
+
"test:watch": "node node_modules/mocha/bin/mocha --watch spec --slow 500 --reporter mocha-better-spec-reporter",
|
|
74
|
+
"test:browser": "npm run build:all && node node_modules/karma/bin/karma start --single-run",
|
|
75
|
+
"test": "npm run test:node",
|
|
76
|
+
"todo": "node scripts/todo.js"
|
|
77
|
+
}
|
|
78
|
+
}
|
package/src/async.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
function AsyncResolvers(onFailedOne, onResolvedAll) {
|
|
2
|
+
this.onResolvedAll = onResolvedAll;
|
|
3
|
+
this.onFailedOne = onFailedOne;
|
|
4
|
+
this.resolvers = {};
|
|
5
|
+
this.resolversCount = 0;
|
|
6
|
+
this.passed = [];
|
|
7
|
+
this.failed = [];
|
|
8
|
+
this.firing = false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
AsyncResolvers.prototype = {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Add resolver
|
|
15
|
+
*
|
|
16
|
+
* @param {Rule} rule
|
|
17
|
+
* @return {integer}
|
|
18
|
+
*/
|
|
19
|
+
add: function(rule) {
|
|
20
|
+
var index = this.resolversCount;
|
|
21
|
+
this.resolvers[index] = rule;
|
|
22
|
+
this.resolversCount++;
|
|
23
|
+
return index;
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Resolve given index
|
|
28
|
+
*
|
|
29
|
+
* @param {integer} index
|
|
30
|
+
* @return {void}
|
|
31
|
+
*/
|
|
32
|
+
resolve: function(index) {
|
|
33
|
+
var rule = this.resolvers[index];
|
|
34
|
+
if (rule.passes === true) {
|
|
35
|
+
this.passed.push(rule);
|
|
36
|
+
} else if (rule.passes === false) {
|
|
37
|
+
this.failed.push(rule);
|
|
38
|
+
this.onFailedOne(rule);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
this.fire();
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Determine if all have been resolved
|
|
46
|
+
*
|
|
47
|
+
* @return {boolean}
|
|
48
|
+
*/
|
|
49
|
+
isAllResolved: function() {
|
|
50
|
+
return (this.passed.length + this.failed.length) === this.resolversCount;
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Attempt to fire final all resolved callback if completed
|
|
55
|
+
*
|
|
56
|
+
* @return {void}
|
|
57
|
+
*/
|
|
58
|
+
fire: function() {
|
|
59
|
+
|
|
60
|
+
if (!this.firing) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (this.isAllResolved()) {
|
|
65
|
+
this.onResolvedAll(this.failed.length === 0);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Enable firing
|
|
72
|
+
*
|
|
73
|
+
* @return {void}
|
|
74
|
+
*/
|
|
75
|
+
enableFiring: function() {
|
|
76
|
+
this.firing = true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
module.exports = AsyncResolvers;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
var replacements = {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Between replacement (replaces :min and :max)
|
|
5
|
+
*
|
|
6
|
+
* @param {string} template
|
|
7
|
+
* @param {Rule} rule
|
|
8
|
+
* @return {string}
|
|
9
|
+
*/
|
|
10
|
+
between: function(template, rule) {
|
|
11
|
+
var parameters = rule.getParameters();
|
|
12
|
+
return this._replacePlaceholders(rule, template, {
|
|
13
|
+
min: parameters[0],
|
|
14
|
+
max: parameters[1]
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Digits-Between replacement (replaces :min and :max)
|
|
20
|
+
*
|
|
21
|
+
* @param {string} template
|
|
22
|
+
* @param {Rule} rule
|
|
23
|
+
* @return {string}
|
|
24
|
+
*/
|
|
25
|
+
digits_between: function(template, rule) {
|
|
26
|
+
var parameters = rule.getParameters();
|
|
27
|
+
return this._replacePlaceholders(rule, template, {
|
|
28
|
+
min: parameters[0],
|
|
29
|
+
max: parameters[1]
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Required_if replacement.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} template
|
|
37
|
+
* @param {Rule} rule
|
|
38
|
+
* @return {string}
|
|
39
|
+
*/
|
|
40
|
+
required_if: function(template, rule) {
|
|
41
|
+
var parameters = rule.getParameters();
|
|
42
|
+
return this._replacePlaceholders(rule, template, {
|
|
43
|
+
other: this._getAttributeName(parameters[0]),
|
|
44
|
+
value: parameters[1]
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Required_unless replacement.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} template
|
|
52
|
+
* @param {Rule} rule
|
|
53
|
+
* @return {string}
|
|
54
|
+
*/
|
|
55
|
+
required_unless: function(template, rule) {
|
|
56
|
+
var parameters = rule.getParameters();
|
|
57
|
+
return this._replacePlaceholders(rule, template, {
|
|
58
|
+
other: this._getAttributeName(parameters[0]),
|
|
59
|
+
value: parameters[1]
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Required_with replacement.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} template
|
|
67
|
+
* @param {Rule} rule
|
|
68
|
+
* @return {string}
|
|
69
|
+
*/
|
|
70
|
+
required_with: function(template, rule) {
|
|
71
|
+
var parameters = rule.getParameters();
|
|
72
|
+
return this._replacePlaceholders(rule, template, {
|
|
73
|
+
field: this._getAttributeName(parameters[0])
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Required_with_all replacement.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} template
|
|
81
|
+
* @param {Rule} rule
|
|
82
|
+
* @return {string}
|
|
83
|
+
*/
|
|
84
|
+
required_with_all: function(template, rule) {
|
|
85
|
+
var parameters = rule.getParameters();
|
|
86
|
+
var getAttributeName = this._getAttributeName.bind(this);
|
|
87
|
+
return this._replacePlaceholders(rule, template, {
|
|
88
|
+
fields: parameters.map(getAttributeName).join(', ')
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Required_without replacement.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} template
|
|
96
|
+
* @param {Rule} rule
|
|
97
|
+
* @return {string}
|
|
98
|
+
*/
|
|
99
|
+
required_without: function(template, rule) {
|
|
100
|
+
var parameters = rule.getParameters();
|
|
101
|
+
return this._replacePlaceholders(rule, template, {
|
|
102
|
+
field: this._getAttributeName(parameters[0])
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Required_without_all replacement.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} template
|
|
110
|
+
* @param {Rule} rule
|
|
111
|
+
* @return {string}
|
|
112
|
+
*/
|
|
113
|
+
required_without_all: function(template, rule) {
|
|
114
|
+
var parameters = rule.getParameters();
|
|
115
|
+
var getAttributeName = this._getAttributeName.bind(this);
|
|
116
|
+
return this._replacePlaceholders(rule, template, {
|
|
117
|
+
fields: parameters.map(getAttributeName).join(', ')
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* After replacement.
|
|
123
|
+
*
|
|
124
|
+
* @param {string} template
|
|
125
|
+
* @param {Rule} rule
|
|
126
|
+
* @return {string}
|
|
127
|
+
*/
|
|
128
|
+
after: function(template, rule) {
|
|
129
|
+
var parameters = rule.getParameters();
|
|
130
|
+
return this._replacePlaceholders(rule, template, {
|
|
131
|
+
after: this._getAttributeName(parameters[0])
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Before replacement.
|
|
137
|
+
*
|
|
138
|
+
* @param {string} template
|
|
139
|
+
* @param {Rule} rule
|
|
140
|
+
* @return {string}
|
|
141
|
+
*/
|
|
142
|
+
before: function(template, rule) {
|
|
143
|
+
var parameters = rule.getParameters();
|
|
144
|
+
return this._replacePlaceholders(rule, template, {
|
|
145
|
+
before: this._getAttributeName(parameters[0])
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* After_or_equal replacement.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} template
|
|
153
|
+
* @param {Rule} rule
|
|
154
|
+
* @return {string}
|
|
155
|
+
*/
|
|
156
|
+
after_or_equal: function(template, rule) {
|
|
157
|
+
var parameters = rule.getParameters();
|
|
158
|
+
return this._replacePlaceholders(rule, template, {
|
|
159
|
+
after_or_equal: this._getAttributeName(parameters[0])
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Before_or_equal replacement.
|
|
165
|
+
*
|
|
166
|
+
* @param {string} template
|
|
167
|
+
* @param {Rule} rule
|
|
168
|
+
* @return {string}
|
|
169
|
+
*/
|
|
170
|
+
before_or_equal: function(template, rule) {
|
|
171
|
+
var parameters = rule.getParameters();
|
|
172
|
+
return this._replacePlaceholders(rule, template, {
|
|
173
|
+
before_or_equal: this._getAttributeName(parameters[0])
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Same replacement.
|
|
179
|
+
*
|
|
180
|
+
* @param {string} template
|
|
181
|
+
* @param {Rule} rule
|
|
182
|
+
* @return {string}
|
|
183
|
+
*/
|
|
184
|
+
same: function(template, rule) {
|
|
185
|
+
var parameters = rule.getParameters();
|
|
186
|
+
return this._replacePlaceholders(rule, template, {
|
|
187
|
+
same: this._getAttributeName(parameters[0])
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
function formatter(attribute) {
|
|
193
|
+
return attribute.replace(/[_\[]/g, ' ').replace(/]/g, '');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
module.exports = {
|
|
197
|
+
replacements: replacements,
|
|
198
|
+
formatter: formatter
|
|
199
|
+
};
|
package/src/errors.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var Errors = function() {
|
|
2
|
+
this.errors = {};
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
Errors.prototype = {
|
|
6
|
+
constructor: Errors,
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Add new error message for given attribute
|
|
10
|
+
*
|
|
11
|
+
* @param {string} attribute
|
|
12
|
+
* @param {string} message
|
|
13
|
+
* @return {void}
|
|
14
|
+
*/
|
|
15
|
+
add: function(attribute, message) {
|
|
16
|
+
if (!this.has(attribute)) {
|
|
17
|
+
this.errors[attribute] = [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (this.errors[attribute].indexOf(message) === -1) {
|
|
21
|
+
this.errors[attribute].push(message);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Returns an array of error messages for an attribute, or an empty array
|
|
27
|
+
*
|
|
28
|
+
* @param {string} attribute A key in the data object being validated
|
|
29
|
+
* @return {array} An array of error messages
|
|
30
|
+
*/
|
|
31
|
+
get: function(attribute) {
|
|
32
|
+
if (this.has(attribute)) {
|
|
33
|
+
return this.errors[attribute];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return [];
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Returns the first error message for an attribute, false otherwise
|
|
41
|
+
*
|
|
42
|
+
* @param {string} attribute A key in the data object being validated
|
|
43
|
+
* @return {string|false} First error message or false
|
|
44
|
+
*/
|
|
45
|
+
first: function(attribute) {
|
|
46
|
+
if (this.has(attribute)) {
|
|
47
|
+
return this.errors[attribute][0];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return false;
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get all error messages from all failing attributes
|
|
55
|
+
*
|
|
56
|
+
* @return {Object} Failed attribute names for keys and an array of messages for values
|
|
57
|
+
*/
|
|
58
|
+
all: function() {
|
|
59
|
+
return this.errors;
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Determine if there are any error messages for an attribute
|
|
64
|
+
*
|
|
65
|
+
* @param {string} attribute A key in the data object being validated
|
|
66
|
+
* @return {boolean}
|
|
67
|
+
*/
|
|
68
|
+
has: function(attribute) {
|
|
69
|
+
if (this.errors.hasOwnProperty(attribute)) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
module.exports = Errors;
|
package/src/lang/ar.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
accepted: "الصفة :attribute يجب أن تكون مقبولة",
|
|
3
|
+
after: "الصفة :attribute يجب أن تكون بعد الصفة :after.",
|
|
4
|
+
after_or_equal: "الصفة :attribute يجب أن تكون مساوية أو بعد الصفة :after_or_equal.",
|
|
5
|
+
alpha: "حقل الصفة :attribute يجب أن تحتوي على أحرف فقط",
|
|
6
|
+
alpha_dash: "حقل الصفة :attribute مسموح بأن يحتوي على حروف و أرقام و شرطة و شرطة منخفضة",
|
|
7
|
+
alpha_num: "حقل الصفة :attribute يجب أن يحتوي على أحرف و أرقام",
|
|
8
|
+
before: "الصفة :attribute يجب أن تكون قبل :before.",
|
|
9
|
+
before_or_equal: "الصفة :attribute يجب أن تكون مساوية أو قبل الصفة :before_or_equal.",
|
|
10
|
+
between: "حقل الصفة :attribute يجب أن يكون بين :min و :max.",
|
|
11
|
+
confirmed: "تأكيد الصفة :attribute غير متطابق.",
|
|
12
|
+
email: "الصفة :attribute صيغتها غير صحيحة",
|
|
13
|
+
date: "الصفة :attribute صيغتها ليست تاريخ صحيح",
|
|
14
|
+
def: "الصفة :attribute تحتوي على أخطاء",
|
|
15
|
+
digits: "الصفة :attribute يجب أن تكون :digits أرقام.",
|
|
16
|
+
digits_between: "يجب أن يحتوي :attribute بين :min و :max رقمًا/أرقام .",
|
|
17
|
+
different: "الصفة :attribute و الصفة :different يجب أن تكونا مختلفتين",
|
|
18
|
+
in: "الصفة :attribute المختارة، غير صحيحة.",
|
|
19
|
+
integer: "الصفة :attribute يجب أن تكون عدد صحيح",
|
|
20
|
+
hex: "حقل الصفة :attribute يجب أن يحتوي على صيغة هكسيديسمل",
|
|
21
|
+
min: {
|
|
22
|
+
numeric: "الصفة :attribute يجب أن تكون :min على الأقل",
|
|
23
|
+
string: "الصفة :attribute يجب أن تكون :min حرف على الأقل."
|
|
24
|
+
},
|
|
25
|
+
max: {
|
|
26
|
+
numeric: "الصفة :attribute لا يمكن أن تكون أكبر من :max.",
|
|
27
|
+
string: "الصفة :attribute يجب أن لا تكون أكثر من :max حرف."
|
|
28
|
+
},
|
|
29
|
+
not_in: "الصفة :attribute المختارة غير صحيحة.",
|
|
30
|
+
numeric: "الصفة :attribute يجب أن تكون رقما.",
|
|
31
|
+
present: "حقل الصفة :attribute يجب أن يكون معرفا ، يمكن أن يكون فارغا.",
|
|
32
|
+
required: "حقل الصفة :attribute مطلوب.",
|
|
33
|
+
required_if: "حقل الصفة :attribute مطلوب حين تكون قيمة الحقل :other تساوي :value.",
|
|
34
|
+
required_unless: "حقل الصفة :attribute مطلوب حين تكون قيم الحقل :other لا تساوي :value.",
|
|
35
|
+
required_with: "حقل الصفة :attribute مطلوب حين يكون الحقا :field غير فارغ.",
|
|
36
|
+
required_with_all: "حقل الصفة :attribute مطلوب حين تكون الحقول :fields غير فارغة.",
|
|
37
|
+
required_without: "حقل الصفة :attribute مطلوب حين يكون الحقل :field فارغا.",
|
|
38
|
+
required_without_all: "حقل الصفة :attribute مطلوب حين تكون الحقول :fields فارغة.",
|
|
39
|
+
same: "حقل الصفة :attribute و حقل الصفة :same يجب أن يتطابقا.",
|
|
40
|
+
size: {
|
|
41
|
+
numeric: "الصفة :attribute يجب أن تكون :size.",
|
|
42
|
+
string: "الصفة :attribute يجب أن تكون :size حرفا."
|
|
43
|
+
},
|
|
44
|
+
string: "الصفة :attribute يجب أن تكون نص.",
|
|
45
|
+
url: "الصفة :attribute صياغتها غير صحيحة.",
|
|
46
|
+
regex: "الصفة :attribute صياغتها غير صحيحة.",
|
|
47
|
+
attributes: {
|
|
48
|
+
username: "اسم المستخدم",
|
|
49
|
+
password: "كلمة المرور",
|
|
50
|
+
email: "البريد الالكتروني",
|
|
51
|
+
website: "الموقع الالكتروني",
|
|
52
|
+
firstname: "الاسم الاول",
|
|
53
|
+
lastname: "الاسم الاخير",
|
|
54
|
+
subject: "الموضوع",
|
|
55
|
+
city: "المدينة",
|
|
56
|
+
region: "المنطقة",
|
|
57
|
+
country: "الدولة",
|
|
58
|
+
street: "الشارع",
|
|
59
|
+
zipcode: "الرمز البريدي",
|
|
60
|
+
phone: "رقم الهاتف",
|
|
61
|
+
mobile: "رقم الجوال"
|
|
62
|
+
}
|
|
63
|
+
};
|
package/src/lang/az.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
accepted: ":attribute qəbul edilməlidir",
|
|
3
|
+
active_url: ":attribute doğru URL deyil",
|
|
4
|
+
after: ":attribute :date tarixindən sonra olmalıdır",
|
|
5
|
+
after_or_equal: ":attribute :date tarixi ilə eyni və ya sonra olmalıdır",
|
|
6
|
+
alpha: ":attribute yalnız hərflərdən ibarət ola bilər",
|
|
7
|
+
alpha_dash: ":attribute yalnız hərf, rəqəm və tire simvolundan ibarət ola bilər",
|
|
8
|
+
alpha_num: ":attribute yalnız hərf və rəqəmlərdən ibarət ola bilər",
|
|
9
|
+
array: ":attribute massiv formatında olmalıdır",
|
|
10
|
+
before: ":attribute :date tarixindən əvvəl olmalıdır",
|
|
11
|
+
before_or_equal: ":attribute :date tarixindən əvvəl və ya bərabər olmalıdır",
|
|
12
|
+
between: {
|
|
13
|
+
numeric: ":attribute :min ilə :max arasında olmalıdır",
|
|
14
|
+
file: ":attribute :min ilə :max KB ölçüsü intervalında olmalıdır",
|
|
15
|
+
string: ":attribute :min ilə :max simvolu intervalında olmalıdır",
|
|
16
|
+
array: ":attribute :min ilə :max intervalında hissədən ibarət olmalıdır"
|
|
17
|
+
},
|
|
18
|
+
boolean: " :attribute doğru və ya yanlış ola bilər",
|
|
19
|
+
confirmed: " :attribute doğrulanması yanlışdır",
|
|
20
|
+
date: " :attribute tarix formatında olmalıdır",
|
|
21
|
+
date_format: " :attribute :format formatında olmalıdır",
|
|
22
|
+
different: " :attribute və :other fərqli olmalıdır",
|
|
23
|
+
digits: " :attribute :digits rəqəmli olmalıdır",
|
|
24
|
+
digits_between: " :attribute :min ilə :max rəqəmləri intervalında olmalıdır",
|
|
25
|
+
dimensions: " :attribute doğru şəkil ölçülərində deyil",
|
|
26
|
+
distinct: " :attribute dublikat qiymətlidir",
|
|
27
|
+
email: " :attribute doğru email formatında deyil",
|
|
28
|
+
exists: " seçilmiş :attribute yanlışdır",
|
|
29
|
+
file: " :attribute fayl formatında olmalıdır",
|
|
30
|
+
filled: " :attribute qiyməti olmalıdır",
|
|
31
|
+
gt: {
|
|
32
|
+
numeric: "The :attribute must be greater than :value.",
|
|
33
|
+
file: "The :attribute must be greater than :value kilobytes.",
|
|
34
|
+
string: "The :attribute must be greater than :value characters.",
|
|
35
|
+
array: "The :attribute must have more than :value items."
|
|
36
|
+
},
|
|
37
|
+
gte: {
|
|
38
|
+
numeric: "The :attribute must be greater than or equal :value.",
|
|
39
|
+
file: "The :attribute must be greater than or equal :value kilobytes.",
|
|
40
|
+
string: "The :attribute must be greater than or equal :value characters.",
|
|
41
|
+
array: "The :attribute must have :value items or more."
|
|
42
|
+
},
|
|
43
|
+
image: " :attribute şəkil formatında olmalıdır",
|
|
44
|
+
in: " seçilmiş :attribute yanlışdır",
|
|
45
|
+
in_array: " :attribute :other qiymətləri arasında olmalıdır",
|
|
46
|
+
integer: " :attribute tam ədəd olmalıdır",
|
|
47
|
+
hex: "The :attribute field should have hexadecimal format",
|
|
48
|
+
ip: " :attribute İP adres formatında olmalıdır",
|
|
49
|
+
ipv4: " :attribute İPv4 adres formatında olmalıdır",
|
|
50
|
+
ipv6: " :attribute İPv6 adres formatında olmalıdır",
|
|
51
|
+
json: " :attribute JSON formatında olmalıdır",
|
|
52
|
+
lt: {
|
|
53
|
+
numeric: "The :attribute must be less than :value.",
|
|
54
|
+
file: "The :attribute must be less than :value kilobytes.",
|
|
55
|
+
string: "The :attribute must be less than :value characters.",
|
|
56
|
+
array: "The :attribute must have less than :value items."
|
|
57
|
+
},
|
|
58
|
+
lte: {
|
|
59
|
+
numeric: "The :attribute must be less than or equal :value.",
|
|
60
|
+
file: "The :attribute must be less than or equal :value kilobytes.",
|
|
61
|
+
string: "The :attribute must be less than or equal :value characters.",
|
|
62
|
+
array: "The :attribute must not have more than :value items."
|
|
63
|
+
},
|
|
64
|
+
max: {
|
|
65
|
+
numeric: " :attribute maksiumum :max rəqəmdən ibarət ola bilər",
|
|
66
|
+
file: " :attribute maksimum :max KB ölçüsündə ola bilər",
|
|
67
|
+
string: " :attribute maksimum :max simvoldan ibarət ola bilər",
|
|
68
|
+
array: " :attribute maksimum :max hədd'dən ibarət ola bilər"
|
|
69
|
+
},
|
|
70
|
+
mimes: " :attribute :values tipində fayl olmalıdır",
|
|
71
|
+
mimetypes: " :attribute :values tipində fayl olmalıdır",
|
|
72
|
+
min: {
|
|
73
|
+
numeric: " :attribute minimum :min rəqəmdən ibarət ola bilər",
|
|
74
|
+
file: " :attribute minimum :min KB ölçüsündə ola bilər",
|
|
75
|
+
string: " :attribute minimum :min simvoldan ibarət ola bilər",
|
|
76
|
+
array: " :attribute minimum :min hədd'dən ibarət ola bilər"
|
|
77
|
+
},
|
|
78
|
+
not_in: " seçilmiş :attribute yanlışdır",
|
|
79
|
+
numeric: " :attribute rəqəmlərdən ibarət olmalıdır",
|
|
80
|
+
present: " :attribute iştirak etməlidir",
|
|
81
|
+
regex: " :attribute formatı yanlışdır",
|
|
82
|
+
required: " :attribute mütləqdir",
|
|
83
|
+
required_if: " :attribute (:other :value ikən) mütləqdir",
|
|
84
|
+
required_unless: " :attribute (:other :values 'ə daxil ikən) mütləqdir",
|
|
85
|
+
required_with: " :attribute (:values var ikən) mütləqdir",
|
|
86
|
+
required_with_all: " :attribute (:values var ikən) mütləqdir",
|
|
87
|
+
required_without: " :attribute (:values yox ikən) mütləqdir",
|
|
88
|
+
required_without_all: " :attribute (:values yox ikən) mütləqdir",
|
|
89
|
+
same: " :attribute və :other eyni olmalıdır",
|
|
90
|
+
size: {
|
|
91
|
+
numeric: " :attribute :size ölçüsündə olmalıdır",
|
|
92
|
+
file: " :attribute :size KB ölçüsündə olmalıdır",
|
|
93
|
+
string: " :attribute :size simvoldan ibarət olmalıdır",
|
|
94
|
+
array: " :attribute :size hədd'dən ibarət olmalıdır"
|
|
95
|
+
},
|
|
96
|
+
string: " :attribute hərf formatında olmalıdır",
|
|
97
|
+
timezone: " :attribute ərazi formatında olmalıdır",
|
|
98
|
+
unique: " :attribute artıq iştirak edib",
|
|
99
|
+
uploaded: " :attribute yüklənməsi mümkün olmadı",
|
|
100
|
+
url: " :attribute formatı yanlışdır"
|
|
101
|
+
};
|