Download pool/shard004/JavaScript/0025158_requiredChecker.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 938 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard004/JavaScript/0025158_requiredChecker.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard004/JavaScript/0025158_requiredChecker.js
-
curl -L -o 0025158_requiredChecker.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard004/JavaScript/0025158_requiredChecker.js
938 Bytes
| /** | |
| * UB RIA Base | |
| * Copyright 2014 Baidu Inc. All rights reserved. | |
| * | |
| * @file 必填字段校验器 | |
| * @author yanghuabei(yanghuabei@baidu.com) | |
| */ | |
| define( | |
| function (require) { | |
| var u = require('../../util'); | |
| var checker = { | |
| name: 'required', | |
| errorMessage: '${title}不能为空', | |
| priority: 1, | |
| check: check | |
| }; | |
| /** | |
| * required检验器 | |
| * 检验逻辑:undefined, null, {}, [], ''均无法通过校验 | |
| * | |
| * @param {string | boolean | number | object | array | undefined} value 输入的值 | |
| * @param {Array} schema 字段的定义、约束, 长度为3的数组 | |
| * @return {boolean} 检验成功返回true,失败返回false | |
| */ | |
| function check(value, schema) { | |
| return !u.isEmpty(value) || u.isNumber(value) || u.isBoolean(value); | |
| } | |
| return checker; | |
| } | |
| ); | |