From 77dd9709e9761949179aa609c80fdea4eb245bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E6=96=B0?= <73146951+4xii@users.noreply.github.com> Date: Wed, 6 Apr 2022 12:19:38 +0800 Subject: [PATCH] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit check the array itemType rule,there is no demo。 Add this demo will be more intuitive --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 4e304a3..4bf6a63 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,24 @@ If type is `array`, there has four addition rule: - `itemType` - The type of every item in this array. - `rule` - An object that validate the items of the array. Only work with `itemType`. + ```js + /** + * check array + * { + * type: 'array', + * itemType: 'string' + * rule: {type: 'string', allowEmpty: true} + * } + * + * { + * type: 'array'. + * itemType: 'object', + * rule: { + * name: 'string' + * } + * } + */ + ``` - `max` - The maximum length of the array. - `min` - The minimum lenght of the array.