b4dfedfffefec1c02cfab3d9ca09bf94.json
3.1 KB
{"ast":null,"code":"function endsWith(str, suffix) {\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\n}\n\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\n if (validType.charAt(0) === '.') {\n return endsWith(fileName.toLowerCase(), validType.toLowerCase());\n }\n\n if (/\\/\\*$/.test(validType)) {\n // This is something like a image/* mime type\n return baseMimeType === validType.replace(/\\/.*$/, '');\n }\n\n return mimeType === validType;\n });\n }\n\n return true;\n});","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-upload/es/attr-accept.js"],"names":["endsWith","str","suffix","indexOf","length","file","acceptedFiles","acceptedFilesArray","Array","isArray","split","fileName","name","mimeType","type","baseMimeType","replace","some","validType","trim","charAt","toLowerCase","test"],"mappings":"AAAA,SAASA,QAAT,CAAkBC,GAAlB,EAAuBC,MAAvB,EAA+B;AAC7B,SAAOD,GAAG,CAACE,OAAJ,CAAYD,MAAZ,EAAoBD,GAAG,CAACG,MAAJ,GAAaF,MAAM,CAACE,MAAxC,MAAoD,CAAC,CAA5D;AACD;;AAED,gBAAgB,UAAUC,IAAV,EAAgBC,aAAhB,EAA+B;AAC7C,MAAID,IAAI,IAAIC,aAAZ,EAA2B;AACzB,QAAIC,kBAAkB,GAAGC,KAAK,CAACC,OAAN,CAAcH,aAAd,IAA+BA,aAA/B,GAA+CA,aAAa,CAACI,KAAd,CAAoB,GAApB,CAAxE;AACA,QAAIC,QAAQ,GAAGN,IAAI,CAACO,IAAL,IAAa,EAA5B;AACA,QAAIC,QAAQ,GAAGR,IAAI,CAACS,IAAL,IAAa,EAA5B;AACA,QAAIC,YAAY,GAAGF,QAAQ,CAACG,OAAT,CAAiB,OAAjB,EAA0B,EAA1B,CAAnB;AACA,WAAOT,kBAAkB,CAACU,IAAnB,CAAwB,UAAUH,IAAV,EAAgB;AAC7C,UAAII,SAAS,GAAGJ,IAAI,CAACK,IAAL,EAAhB;;AAEA,UAAID,SAAS,CAACE,MAAV,CAAiB,CAAjB,MAAwB,GAA5B,EAAiC;AAC/B,eAAOpB,QAAQ,CAACW,QAAQ,CAACU,WAAT,EAAD,EAAyBH,SAAS,CAACG,WAAV,EAAzB,CAAf;AACD;;AAED,UAAI,QAAQC,IAAR,CAAaJ,SAAb,CAAJ,EAA6B;AAC3B;AACA,eAAOH,YAAY,KAAKG,SAAS,CAACF,OAAV,CAAkB,OAAlB,EAA2B,EAA3B,CAAxB;AACD;;AAED,aAAOH,QAAQ,KAAKK,SAApB;AACD,KAbM,CAAP;AAcD;;AAED,SAAO,IAAP;AACD,CAvBD","sourcesContent":["function endsWith(str, suffix) {\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\n}\n\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\n if (validType.charAt(0) === '.') {\n return endsWith(fileName.toLowerCase(), validType.toLowerCase());\n }\n\n if (/\\/\\*$/.test(validType)) {\n // This is something like a image/* mime type\n return baseMimeType === validType.replace(/\\/.*$/, '');\n }\n\n return mimeType === validType;\n });\n }\n\n return true;\n});"]},"metadata":{},"sourceType":"module"}