PromoCursed/node_modules/.cache/babel-loader/34a7e8870ea7efe21834d3f2ed8a56d3565943d7d59112cdec1ca774666f5670.json

1 line
9.7 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport { format } from \"../util\";\nimport required from \"./required\";\nimport getUrlRegex from \"./url\";\n/* eslint max-len:0 */\n\nvar pattern = {\n // http://emailregex.com/\n email: /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+\\.)+[a-zA-Z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]{2,}))$/,\n // url: new RegExp(\n // '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\\\S+(?::\\\\S*)?@)?(?:(?:(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}(?:\\\\.(?:[0-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))|(?:(?:[a-z\\\\u00a1-\\\\uffff0-9]+-*)*[a-z\\\\u00a1-\\\\uffff0-9]+)(?:\\\\.(?:[a-z\\\\u00a1-\\\\uffff0-9]+-*)*[a-z\\\\u00a1-\\\\uffff0-9]+)*(?:\\\\.(?:[a-z\\\\u00a1-\\\\uffff]{2,})))|localhost)(?::\\\\d{2,5})?(?:(/|\\\\?|#)[^\\\\s]*)?$',\n // 'i',\n // ),\n hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i\n};\nvar types = {\n integer: function integer(value) {\n return types.number(value) && parseInt(value, 10) === value;\n },\n float: function float(value) {\n return types.number(value) && !types.integer(value);\n },\n array: function array(value) {\n return Array.isArray(value);\n },\n regexp: function regexp(value) {\n if (value instanceof RegExp) {\n return true;\n }\n try {\n return !!new RegExp(value);\n } catch (e) {\n return false;\n }\n },\n date: function date(value) {\n return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear === 'function' && !isNaN(value.getTime());\n },\n number: function number(value) {\n if (isNaN(value)) {\n return false;\n }\n return typeof value === 'number';\n },\n object: function object(value) {\n return _typeof(value) === 'object' && !types.array(value);\n },\n method: function method(value) {\n return typeof value === 'function';\n },\n email: function email(value) {\n return typeof value === 'string' && value.length <= 320 && !!value.match(pattern.email);\n },\n url: function url(value) {\n return typeof value === 'string' && value.length <= 2048 && !!value.match(getUrlRegex());\n },\n hex: function hex(value) {\n return typeof value === 'string' && !!value.match(pattern.hex);\n }\n};\nvar type = function type(rule, value, source, errors, options) {\n if (rule.required && value === undefined) {\n required(rule, value, source, errors, options);\n return;\n }\n var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'number', 'date', 'url', 'hex'];\n var ruleType = rule.type;\n if (custom.indexOf(ruleType) > -1) {\n if (!types[ruleType](value)) {\n errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));\n }\n // straight typeof check\n } else if (ruleType && _typeof(value) !== rule.type) {\n errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));\n }\n};\nexport default type;","map":{"version":3,"names":["_typeof","format","required","getUrlRegex","pattern","email","hex","types","integer","value","number","parseInt","float","array","Array","isArray","regexp","RegExp","e","date","getTime","getMonth","getYear","isNaN","object","method","length","match","url","type","rule","source","errors","options","undefined","custom","ruleType","indexOf","push","messages","fullField"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/@rc-component/async-validator/es/rule/type.js"],"sourcesContent":["import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport { format } from \"../util\";\nimport required from \"./required\";\nimport getUrlRegex from \"./url\";\n/* eslint max-len:0 */\n\nvar pattern = {\n // http://emailregex.com/\n email: /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-