required.js 733 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _typeof2 = require('babel-runtime/helpers/typeof');
  6. var _typeof3 = _interopRequireDefault(_typeof2);
  7. var _rule = require('../rule/');
  8. var _rule2 = _interopRequireDefault(_rule);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10. function required(rule, value, callback, source, options) {
  11. var errors = [];
  12. var type = Array.isArray(value) ? 'array' : typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value);
  13. _rule2['default'].required(rule, value, source, errors, options, type);
  14. callback(errors);
  15. }
  16. exports['default'] = required;
  17. module.exports = exports['default'];