e85076784d4676cf209b4e189fb12eb9.json
6.08 KB
{"ast":null,"code":"function loopFiles(item, callback) {\n var dirReader = item.createReader();\n var fileList = [];\n\n function sequence() {\n dirReader.readEntries(function (entries) {\n var entryList = Array.prototype.slice.apply(entries);\n fileList = fileList.concat(entryList); // Check if all the file has been viewed\n\n var isFinished = !entryList.length;\n\n if (isFinished) {\n callback(fileList);\n } else {\n sequence();\n }\n });\n }\n\n sequence();\n}\n\nvar traverseFileTree = function traverseFileTree(files, callback, isAccepted) {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n var _traverseFileTree = function _traverseFileTree(item, path) {\n // eslint-disable-next-line no-param-reassign\n item.path = path || '';\n\n if (item.isFile) {\n item.file(function (file) {\n if (isAccepted(file)) {\n // https://github.com/ant-design/ant-design/issues/16426\n if (item.fullPath && !file.webkitRelativePath) {\n Object.defineProperties(file, {\n webkitRelativePath: {\n writable: true\n }\n }); // eslint-disable-next-line no-param-reassign\n\n file.webkitRelativePath = item.fullPath.replace(/^\\//, '');\n Object.defineProperties(file, {\n webkitRelativePath: {\n writable: false\n }\n });\n }\n\n callback([file]);\n }\n });\n } else if (item.isDirectory) {\n loopFiles(item, function (entries) {\n entries.forEach(function (entryItem) {\n _traverseFileTree(entryItem, \"\".concat(path).concat(item.name, \"/\"));\n });\n });\n }\n };\n\n files.forEach(function (file) {\n _traverseFileTree(file.webkitGetAsEntry());\n });\n};\n\nexport default traverseFileTree;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-upload/es/traverseFileTree.js"],"names":["loopFiles","item","callback","dirReader","createReader","fileList","sequence","readEntries","entries","entryList","Array","prototype","slice","apply","concat","isFinished","length","traverseFileTree","files","isAccepted","_traverseFileTree","path","isFile","file","fullPath","webkitRelativePath","Object","defineProperties","writable","replace","isDirectory","forEach","entryItem","name","webkitGetAsEntry"],"mappings":"AAAA,SAASA,SAAT,CAAmBC,IAAnB,EAAyBC,QAAzB,EAAmC;AACjC,MAAIC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L,CAAcK,OAAd,CAAsB,KAAtB,EAA6B,EAA7B,CAA1B;AACAH,YAAAA,MAAM,CAACC,gBAAP,CAAwBJ,IAAxB,EAA8B;AAC5BE,cAAAA,kBAAkB,EAAE;AAClBG,gBAAAA,QAAQ,EAAE;AADQ;AADQ,aAA9B;AAKD;;AAED1B,UAAAA,QAAQ,CAAC,CAACqB,IAAD,CAAD,CAAR;AACD;AACF,OApBD;AAqBD,KAtBD,MAsBO,IAAItB,IAAI,CAAC6B,WAAT,EAAsB;AAC3B9B,MAAAA,SAAS,CAACC,IAAD,EAAO,UAAUO,OAAV,EAAmB;AACjCA,QAAAA,OAAO,CAACuB,OAAR,CAAgB,UAAUC,SAAV,EAAqB;AACnCZ,UAAAA,iBAAiB,CAACY,SAAD,EAAY,GAAGlB,MAAH,CAAUO,IAAV,EAAgBP,MAAhB,CAAuBb,IAAI,CAACgC,IAA5B,EAAkC,GAAlC,CAAZ,CAAjB;AACD,SAFD;AAGD,OAJQ,CAAT;AAKD;AACF,GAjCD;;AAmCAf,EAAAA,KAAK,CAACa,OAAN,CAAc,UAAUR,IAAV,EAAgB;AAC5BH,IAAAA,iBAAiB,CAACG,IAAI,CAACW,gBAAL,EAAD,CAAjB;AACD,GAFD;AAGD,CAxCD;;AA0CA,eAAejB,gBAAf","sourcesContent":["function loopFiles(item, callback) {\n var dirReader = item.createReader();\n var fileList = [];\n\n function sequence() {\n dirReader.readEntries(function (entries) {\n var entryList = Array.prototype.slice.apply(entries);\n fileList = fileList.concat(entryList); // Check if all the file has been viewed\n\n var isFinished = !entryList.length;\n\n if (isFinished) {\n callback(fileList);\n } else {\n sequence();\n }\n });\n }\n\n sequence();\n}\n\nvar traverseFileTree = function traverseFileTree(files, callback, isAccepted) {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n var _traverseFileTree = function _traverseFileTree(item, path) {\n // eslint-disable-next-line no-param-reassign\n item.path = path || '';\n\n if (item.isFile) {\n item.file(function (file) {\n if (isAccepted(file)) {\n // https://github.com/ant-design/ant-design/issues/16426\n if (item.fullPath && !file.webkitRelativePath) {\n Object.defineProperties(file, {\n webkitRelativePath: {\n writable: true\n }\n }); // eslint-disable-next-line no-param-reassign\n\n file.webkitRelativePath = item.fullPath.replace(/^\\//, '');\n Object.defineProperties(file, {\n webkitRelativePath: {\n writable: false\n }\n });\n }\n\n callback([file]);\n }\n });\n } else if (item.isDirectory) {\n loopFiles(item, function (entries) {\n entries.forEach(function (entryItem) {\n _traverseFileTree(entryItem, \"\".concat(path).concat(item.name, \"/\"));\n });\n });\n }\n };\n\n files.forEach(function (file) {\n _traverseFileTree(file.webkitGetAsEntry());\n });\n};\n\nexport default traverseFileTree;"]},"metadata":{},"sourceType":"module"}