didi/cube-ui

[New Feature] Validate扩展方法和类型能不能增加链式调用

オープン

#356 opened on 2018/11/26

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (1,503 件のフォーク)batch import
help wanted

Repository metrics

Stars
 (9,088 個のスター)
PR merge metrics
 (PR metrics pending)

説明

What problem does this feature solve?

Validator添加自定义规则时候:

Validator.addRule('odd', (val, config, type) => !config || Number(val) % 2 === 1)
Validator.addMessage('odd', 'Please input odd.')

显得比较蛋疼,最好能链式调用

Validator.addRule('odd', (val, config, type) => !config || Number(val) % 2 === 1)
.addMessage('odd', 'Please input odd.')

显得比较优雅

コントリビューターガイド