1 line
4.9 KiB
JSON
1 line
4.9 KiB
JSON
{"ast":null,"code":"import warning from \"rc-util/es/warning\";\nexport default (function (file, acceptedFiles) {\n if (file && acceptedFiles) {\n var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');\n var fileName = file.name || '';\n var mimeType = file.type || '';\n var baseMimeType = mimeType.replace(/\\/.*$/, '');\n return acceptedFilesArray.some(function (type) {\n var validType = type.trim();\n // This is something like */*,* allow all files\n if (/^\\*(\\/\\*)?$/.test(type)) {\n return true;\n }\n\n // like .jpg, .png\n if (validType.charAt(0) === '.') {\n var lowerFileName = fileName.toLowerCase();\n var lowerType = validType.toLowerCase();\n var affixList = [lowerType];\n if (lowerType === '.jpg' || lowerType === '.jpeg') {\n affixList = ['.jpg', '.jpeg'];\n }\n return affixList.some(function (affix) {\n return lowerFileName.endsWith(affix);\n });\n }\n\n // This is something like a image/* mime type\n if (/\\/\\*$/.test(validType)) {\n return baseMimeType === validType.replace(/\\/.*$/, '');\n }\n\n // Full match\n if (mimeType === validType) {\n return true;\n }\n\n // Invalidate type should skip\n if (/^\\w+$/.test(validType)) {\n warning(false, \"Upload takes an invalidate 'accept' type '\".concat(validType, \"'.Skip for check.\"));\n return true;\n }\n return false;\n });\n }\n return true;\n});","map":{"version":3,"names":["warning","file","acceptedFiles","acceptedFilesArray","Array","isArray","split","fileName","name","mimeType","type","baseMimeType","replace","some","validType","trim","test","charAt","lowerFileName","toLowerCase","lowerType","affixList","affix","endsWith","concat"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-upload/es/attr-accept.js"],"sourcesContent":["import warning from \"rc-util/es/warning\";\nexport default (function (file, acceptedFiles) {\n if (file && acceptedFiles) {\n var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');\n var fileName = file.name || '';\n var mimeType = file.type || '';\n var baseMimeType = mimeType.replace(/\\/.*$/, '');\n return acceptedFilesArray.some(function (type) {\n var validType = type.trim();\n // This is something like */*,* allow all files\n if (/^\\*(\\/\\*)?$/.test(type)) {\n return true;\n }\n\n // like .jpg, .png\n if (validType.charAt(0) === '.') {\n var lowerFileName = fileName.toLowerCase();\n var lowerType = validType.toLowerCase();\n var affixList = [lowerType];\n if (lowerType === '.jpg' || lowerType === '.jpeg') {\n affixList = ['.jpg', '.jpeg'];\n }\n return affixList.some(function (affix) {\n return lowerFileName.endsWith(affix);\n });\n }\n\n // This is something like a image/* mime type\n if (/\\/\\*$/.test(validType)) {\n return baseMimeType === validType.replace(/\\/.*$/, '');\n }\n\n // Full match\n if (mimeType === validType) {\n return true;\n }\n\n // Invalidate type should skip\n if (/^\\w+$/.test(validType)) {\n warning(false, \"Upload takes an invalidate 'accept' type '\".concat(validType, \"'.Skip for check.\"));\n return true;\n }\n return false;\n });\n }\n return true;\n});"],"mappings":"AAAA,OAAOA,OAAO,MAAM,oBAAoB;AACxC,gBAAgB,UAAUC,IAAI,EAAEC,aAAa,EAAE;EAC7C,IAAID,IAAI,IAAIC,aAAa,EAAE;IACzB,IAAIC,kBAAkB,GAAGC,KAAK,CAACC,OAAO,CAACH,aAAa,CAAC,GAAGA,aAAa,GAAGA,aAAa,CAACI,KAAK,CAAC,GAAG,CAAC;IAChG,IAAIC,QAAQ,GAAGN,IAAI,CAACO,IAAI,IAAI,EAAE;IAC9B,IAAIC,QAAQ,GAAGR,IAAI,CAACS,IAAI,IAAI,EAAE;IAC9B,IAAIC,YAAY,GAAGF,QAAQ,CAACG,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;IAChD,OAAOT,kBAAkB,CAACU,IAAI,CAAC,UAAUH,IAAI,EAAE;MAC7C,IAAII,SAAS,GAAGJ,IAAI,CAACK,IAAI,CAAC,CAAC;MAC3B;MACA,IAAI,aAAa,CAACC,IAAI,CAACN,IAAI,CAAC,EAAE;QAC5B,OAAO,IAAI;MACb;;MAEA;MACA,IAAII,SAAS,CAACG,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QA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