Compare commits
9 Commits
0bfa3b32bd
...
c767e73f0a
Author | SHA1 | Date | |
---|---|---|---|
c767e73f0a | |||
7d8256a6d6 | |||
b282f241a6 | |||
b684a0e35e | |||
8645d9914b | |||
057466c952 | |||
564578c160 | |||
e399cb0e30 | |||
6fe8069868 |
@ -1,5 +1,9 @@
|
|||||||
# ChangeLog
|
# ChangeLog
|
||||||
|
|
||||||
|
## 2020-07-05 (0.0.7)
|
||||||
|
|
||||||
|
- fix array check contains type
|
||||||
|
|
||||||
## 2020-07-04 (0.0.6)
|
## 2020-07-04 (0.0.6)
|
||||||
|
|
||||||
- add array validate contains type
|
- add array validate contains type
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mtfos-validator",
|
"name": "mtfos-validator",
|
||||||
"version": "0.0.6",
|
"version": "0.0.7",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -61,6 +61,7 @@ class TypeArray extends Base {
|
|||||||
if (this._min !== null && value.length < this._min) return `value length < ${this._min}`
|
if (this._min !== null && value.length < this._min) return `value length < ${this._min}`
|
||||||
if (this._max !== null && value.length > this._max) return `value length > ${this._max}`
|
if (this._max !== null && value.length > this._max) return `value length > ${this._max}`
|
||||||
|
|
||||||
|
if (this._itemTypes.length > 0) {
|
||||||
for (const item of value) {
|
for (const item of value) {
|
||||||
let verified = false
|
let verified = false
|
||||||
let fail = ''
|
let fail = ''
|
||||||
@ -76,6 +77,7 @@ class TypeArray extends Base {
|
|||||||
}
|
}
|
||||||
if (!verified || fail) return fail || `item type not match`
|
if (!verified || fail) return fail || `item type not match`
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user