diff --git a/package-lock.json b/package-lock.json index cc93aa5..2414551 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "validatorjs", "version": "3.22.1", "license": "MIT", "devDependencies": { @@ -957,7 +958,6 @@ "anymatch": "^2.0.0", "async-each": "^1.0.1", "braces": "^2.3.2", - "fsevents": "^1.2.7", "glob-parent": "^3.1.0", "inherits": "^2.0.3", "is-binary-path": "^1.0.0", @@ -2065,8 +2065,7 @@ "esprima": "^2.7.1", "estraverse": "^1.9.1", "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" + "optionator": "^0.8.1" }, "bin": { "escodegen": "bin/escodegen.js", @@ -4359,8 +4358,7 @@ "dependencies": { "neo-async": "^2.6.0", "optimist": "^0.6.1", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4" + "source-map": "^0.6.1" }, "bin": { "handlebars": "bin/handlebars" @@ -5243,9 +5241,6 @@ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, - "dependencies": { - "graceful-fs": "^4.1.6" - }, "optionalDependencies": { "graceful-fs": "^4.1.6" } @@ -5473,7 +5468,6 @@ "dependencies": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", diff --git a/src/lang/en.js b/src/lang/en.js index e481f53..dc9f076 100755 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -23,11 +23,13 @@ module.exports = { hex: 'The :attribute field should have hexadecimal format', min: { numeric: 'The :attribute must be at least :min.', - string: 'The :attribute must be at least :min characters.' + string: 'The :attribute must be at least :min characters.', + array: 'The :attribute must be at least :min item' }, max: { numeric: 'The :attribute may not be greater than :max.', - string: 'The :attribute may not be greater than :max characters.' + string: 'The :attribute may not be greater than :max characters.', + array: 'The :attribute may not be greater than :max item' }, not_in: 'The selected :attribute is invalid.', numeric: 'The :attribute must be a number.', diff --git a/src/rules.js b/src/rules.js index a865d50..73ca1d6 100755 --- a/src/rules.js +++ b/src/rules.js @@ -702,8 +702,9 @@ Rule.prototype = { _getValueType: function () { if (typeof this.inputValue === "number" || this.validator._hasNumericRule(this.attribute)) { return "numeric"; + } else if (Array.isArray(this.inputValue)){ + return "array"; } - return "string"; },