read-excel-file 6.0.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +22 -11
  3. package/browser/index.cjs +7 -0
  4. package/{index.d.ts → browser/index.d.ts} +2 -2
  5. package/browser/index.js +6 -0
  6. package/browser/package.json +17 -0
  7. package/bundle/read-excel-file.min.js +1 -1
  8. package/bundle/read-excel-file.min.js.map +1 -1
  9. package/commonjs/export/convertInputToNodeStream.js +45 -0
  10. package/commonjs/export/convertInputToNodeStream.js.map +1 -0
  11. package/commonjs/export/convertValuesFromUint8ArraysToStrings.js +20 -0
  12. package/commonjs/export/convertValuesFromUint8ArraysToStrings.js.map +1 -0
  13. package/commonjs/export/filterZipArchiveEntry.js +18 -0
  14. package/commonjs/export/filterZipArchiveEntry.js.map +1 -0
  15. package/commonjs/{read → export}/readSheetNamesBrowser.js +4 -4
  16. package/commonjs/export/readSheetNamesBrowser.js.map +1 -0
  17. package/commonjs/export/readSheetNamesNode.js.map +1 -0
  18. package/commonjs/export/readSheetNamesUniversal.js +23 -0
  19. package/commonjs/export/readSheetNamesUniversal.js.map +1 -0
  20. package/commonjs/{read → export}/readSheetNamesWebWorker.js +2 -2
  21. package/commonjs/export/readSheetNamesWebWorker.js.map +1 -0
  22. package/commonjs/{read → export}/readXlsxFileBrowser.js +6 -6
  23. package/commonjs/export/readXlsxFileBrowser.js.map +1 -0
  24. package/commonjs/{read → export}/readXlsxFileNode.js +5 -5
  25. package/commonjs/export/readXlsxFileNode.js.map +1 -0
  26. package/commonjs/export/readXlsxFileUniversal.js +24 -0
  27. package/commonjs/export/readXlsxFileUniversal.js.map +1 -0
  28. package/commonjs/{read → export}/readXlsxFileWebWorker.js +5 -5
  29. package/commonjs/export/readXlsxFileWebWorker.js.map +1 -0
  30. package/commonjs/export/unpackXlsxFileBrowser.js +38 -0
  31. package/commonjs/export/unpackXlsxFileBrowser.js.map +1 -0
  32. package/commonjs/export/unpackXlsxFileNode.js +23 -0
  33. package/commonjs/export/unpackXlsxFileNode.js.map +1 -0
  34. package/commonjs/export/unpackXlsxFileUniversal.js +23 -0
  35. package/commonjs/export/unpackXlsxFileUniversal.js.map +1 -0
  36. package/commonjs/types/Date.js +1 -1
  37. package/commonjs/types/Date.js.map +1 -1
  38. package/commonjs/{read → xlsx}/coordinates.js.map +1 -1
  39. package/commonjs/{read → xlsx}/dropEmptyColumns.js.map +1 -1
  40. package/commonjs/{read → xlsx}/dropEmptyColumns.test.js.map +1 -1
  41. package/commonjs/{read → xlsx}/dropEmptyRows.js.map +1 -1
  42. package/commonjs/{read → xlsx}/dropEmptyRows.test.js.map +1 -1
  43. package/commonjs/{read → xlsx}/getData.js.map +1 -1
  44. package/commonjs/{read → xlsx}/isDateTimestamp.js.map +1 -1
  45. package/commonjs/{read → xlsx}/parseCell.js.map +1 -1
  46. package/commonjs/{read → xlsx}/parseCellValue.js.map +1 -1
  47. package/commonjs/{read → xlsx}/parseCells.js.map +1 -1
  48. package/commonjs/{read → xlsx}/parseDate.js.map +1 -1
  49. package/commonjs/{read → xlsx}/parseDate.test.js.map +1 -1
  50. package/commonjs/{read → xlsx}/parseDimensions.js.map +1 -1
  51. package/commonjs/{read → xlsx}/parseFilePaths.js.map +1 -1
  52. package/commonjs/{read → xlsx}/parseProperties.js.map +1 -1
  53. package/commonjs/{read → xlsx}/parseSharedStrings.js.map +1 -1
  54. package/commonjs/{read → xlsx}/parseSheet.js.map +1 -1
  55. package/commonjs/{read → xlsx}/parseStyles.js.map +1 -1
  56. package/commonjs/{read/readXlsx.js → xlsx/parseXlsxFileContents.js} +10 -9
  57. package/commonjs/xlsx/parseXlsxFileContents.js.map +1 -0
  58. package/commonjs/{read/readXlsxFileContents.js → xlsx/parseXlsxFileContentsWithOptionalSchema.js} +13 -6
  59. package/commonjs/xlsx/parseXlsxFileContentsWithOptionalSchema.js.map +1 -0
  60. package/commonjs/{read → xlsx}/schema/mapToObjects.js +0 -4
  61. package/commonjs/xlsx/schema/mapToObjects.js.map +1 -0
  62. package/commonjs/{read → xlsx}/schema/mapToObjects.test.js.map +1 -1
  63. package/commonjs/xml/dom.js +10 -0
  64. package/commonjs/xml/dom.js.map +1 -1
  65. package/commonjs/xml/xlsx.js +10 -2
  66. package/commonjs/xml/xlsx.js.map +1 -1
  67. package/commonjs/zip/unzipFromArrayBuffer.js +74 -0
  68. package/commonjs/zip/unzipFromArrayBuffer.js.map +1 -0
  69. package/commonjs/zip/unzipFromArrayBufferSync.js +33 -0
  70. package/commonjs/zip/unzipFromArrayBufferSync.js.map +1 -0
  71. package/commonjs/zip/unzipFromStream.js +123 -0
  72. package/commonjs/zip/unzipFromStream.js.map +1 -0
  73. package/modules/export/convertInputToNodeStream.js +36 -0
  74. package/modules/export/convertInputToNodeStream.js.map +1 -0
  75. package/modules/export/convertValuesFromUint8ArraysToStrings.js +15 -0
  76. package/modules/export/convertValuesFromUint8ArraysToStrings.js.map +1 -0
  77. package/modules/export/filterZipArchiveEntry.js +12 -0
  78. package/modules/export/filterZipArchiveEntry.js.map +1 -0
  79. package/modules/{read → export}/readSheetNamesBrowser.js +4 -4
  80. package/modules/export/readSheetNamesBrowser.js.map +1 -0
  81. package/modules/export/readSheetNamesNode.js.map +1 -0
  82. package/modules/export/readSheetNamesUniversal.js +17 -0
  83. package/modules/export/readSheetNamesUniversal.js.map +1 -0
  84. package/modules/{read → export}/readSheetNamesWebWorker.js +2 -2
  85. package/modules/export/readSheetNamesWebWorker.js.map +1 -0
  86. package/modules/{read → export}/readXlsxFileBrowser.js +6 -6
  87. package/modules/export/readXlsxFileBrowser.js.map +1 -0
  88. package/modules/{read → export}/readXlsxFileNode.js +5 -5
  89. package/modules/export/readXlsxFileNode.js.map +1 -0
  90. package/modules/export/readXlsxFileUniversal.js +18 -0
  91. package/modules/export/readXlsxFileUniversal.js.map +1 -0
  92. package/modules/{read → export}/readXlsxFileWebWorker.js +5 -5
  93. package/modules/export/readXlsxFileWebWorker.js.map +1 -0
  94. package/modules/export/unpackXlsxFileBrowser.js +30 -0
  95. package/modules/export/unpackXlsxFileBrowser.js.map +1 -0
  96. package/modules/export/unpackXlsxFileNode.js +17 -0
  97. package/modules/export/unpackXlsxFileNode.js.map +1 -0
  98. package/modules/export/unpackXlsxFileUniversal.js +17 -0
  99. package/modules/export/unpackXlsxFileUniversal.js.map +1 -0
  100. package/modules/types/Date.js +1 -1
  101. package/modules/types/Date.js.map +1 -1
  102. package/modules/{read → xlsx}/coordinates.js.map +1 -1
  103. package/modules/{read → xlsx}/dropEmptyColumns.js.map +1 -1
  104. package/modules/{read → xlsx}/dropEmptyColumns.test.js.map +1 -1
  105. package/modules/{read → xlsx}/dropEmptyRows.js.map +1 -1
  106. package/modules/{read → xlsx}/dropEmptyRows.test.js.map +1 -1
  107. package/modules/{read → xlsx}/getData.js.map +1 -1
  108. package/modules/{read → xlsx}/isDateTimestamp.js.map +1 -1
  109. package/modules/{read → xlsx}/parseCell.js.map +1 -1
  110. package/modules/{read → xlsx}/parseCellValue.js.map +1 -1
  111. package/modules/{read → xlsx}/parseCells.js.map +1 -1
  112. package/modules/{read → xlsx}/parseDate.js.map +1 -1
  113. package/modules/{read → xlsx}/parseDate.test.js.map +1 -1
  114. package/modules/{read → xlsx}/parseDimensions.js.map +1 -1
  115. package/modules/{read → xlsx}/parseFilePaths.js.map +1 -1
  116. package/modules/{read → xlsx}/parseProperties.js.map +1 -1
  117. package/modules/{read → xlsx}/parseSharedStrings.js.map +1 -1
  118. package/modules/{read → xlsx}/parseSheet.js.map +1 -1
  119. package/modules/{read → xlsx}/parseStyles.js.map +1 -1
  120. package/modules/{read/readXlsx.js → xlsx/parseXlsxFileContents.js} +9 -8
  121. package/modules/xlsx/parseXlsxFileContents.js.map +1 -0
  122. package/modules/{read/readXlsxFileContents.js → xlsx/parseXlsxFileContentsWithOptionalSchema.js} +13 -5
  123. package/modules/xlsx/parseXlsxFileContentsWithOptionalSchema.js.map +1 -0
  124. package/modules/{read → xlsx}/schema/mapToObjects.js +0 -4
  125. package/modules/xlsx/schema/mapToObjects.js.map +1 -0
  126. package/modules/{read → xlsx}/schema/mapToObjects.test.js.map +1 -1
  127. package/modules/xml/dom.js +9 -0
  128. package/modules/xml/dom.js.map +1 -1
  129. package/modules/xml/xlsx.js +11 -3
  130. package/modules/xml/xlsx.js.map +1 -1
  131. package/modules/zip/unzipFromArrayBuffer.js +67 -0
  132. package/modules/zip/unzipFromArrayBuffer.js.map +1 -0
  133. package/modules/zip/unzipFromArrayBufferSync.js +27 -0
  134. package/modules/zip/unzipFromArrayBufferSync.js.map +1 -0
  135. package/modules/zip/unzipFromStream.js +119 -0
  136. package/modules/zip/unzipFromStream.js.map +1 -0
  137. package/node/index.cjs +4 -4
  138. package/node/index.d.ts +2 -1
  139. package/node/index.js +3 -3
  140. package/package.json +14 -9
  141. package/rollup.config.mjs +1 -1
  142. package/universal/index.cjs +7 -0
  143. package/universal/index.d.ts +28 -0
  144. package/universal/index.js +6 -0
  145. package/universal/package.json +17 -0
  146. package/web-worker/index.cjs +4 -4
  147. package/web-worker/index.js +3 -3
  148. package/commonjs/read/readSheetNamesBrowser.js.map +0 -1
  149. package/commonjs/read/readSheetNamesNode.js.map +0 -1
  150. package/commonjs/read/readSheetNamesNode.test.js.map +0 -1
  151. package/commonjs/read/readSheetNamesWebWorker.js.map +0 -1
  152. package/commonjs/read/readXlsx.js.map +0 -1
  153. package/commonjs/read/readXlsxFileBrowser.js.map +0 -1
  154. package/commonjs/read/readXlsxFileContents.js.map +0 -1
  155. package/commonjs/read/readXlsxFileNode.js.map +0 -1
  156. package/commonjs/read/readXlsxFileNode.test.js.map +0 -1
  157. package/commonjs/read/readXlsxFileWebWorker.js.map +0 -1
  158. package/commonjs/read/schema/mapToObjects.js.map +0 -1
  159. package/commonjs/read/unpackXlsxFileBrowser.js +0 -50
  160. package/commonjs/read/unpackXlsxFileBrowser.js.map +0 -1
  161. package/commonjs/read/unpackXlsxFileNode.js +0 -86
  162. package/commonjs/read/unpackXlsxFileNode.js.map +0 -1
  163. package/index.cjs +0 -7
  164. package/index.cjs.js +0 -12
  165. package/index.js +0 -6
  166. package/modules/read/readSheetNamesBrowser.js.map +0 -1
  167. package/modules/read/readSheetNamesNode.js.map +0 -1
  168. package/modules/read/readSheetNamesNode.test.js.map +0 -1
  169. package/modules/read/readSheetNamesWebWorker.js.map +0 -1
  170. package/modules/read/readXlsx.js.map +0 -1
  171. package/modules/read/readXlsxFileBrowser.js.map +0 -1
  172. package/modules/read/readXlsxFileContents.js.map +0 -1
  173. package/modules/read/readXlsxFileNode.js.map +0 -1
  174. package/modules/read/readXlsxFileNode.test.js.map +0 -1
  175. package/modules/read/readXlsxFileWebWorker.js.map +0 -1
  176. package/modules/read/schema/mapToObjects.js.map +0 -1
  177. package/modules/read/unpackXlsxFileBrowser.js +0 -45
  178. package/modules/read/unpackXlsxFileBrowser.js.map +0 -1
  179. package/modules/read/unpackXlsxFileNode.js +0 -78
  180. package/modules/read/unpackXlsxFileNode.js.map +0 -1
  181. package/node/index.cjs.js +0 -12
  182. package/web-worker/index.cjs.js +0 -12
  183. /package/commonjs/{read → export}/readSheetNamesNode.js +0 -0
  184. /package/commonjs/{read → xlsx}/coordinates.js +0 -0
  185. /package/commonjs/{read → xlsx}/dropEmptyColumns.js +0 -0
  186. /package/commonjs/{read → xlsx}/dropEmptyRows.js +0 -0
  187. /package/commonjs/{read → xlsx}/getData.js +0 -0
  188. /package/commonjs/{read → xlsx}/isDateTimestamp.js +0 -0
  189. /package/commonjs/{read → xlsx}/parseCell.js +0 -0
  190. /package/commonjs/{read → xlsx}/parseCellValue.js +0 -0
  191. /package/commonjs/{read → xlsx}/parseCells.js +0 -0
  192. /package/commonjs/{read → xlsx}/parseDate.js +0 -0
  193. /package/commonjs/{read → xlsx}/parseDimensions.js +0 -0
  194. /package/commonjs/{read → xlsx}/parseFilePaths.js +0 -0
  195. /package/commonjs/{read → xlsx}/parseProperties.js +0 -0
  196. /package/commonjs/{read → xlsx}/parseSharedStrings.js +0 -0
  197. /package/commonjs/{read → xlsx}/parseSheet.js +0 -0
  198. /package/commonjs/{read → xlsx}/parseStyles.js +0 -0
  199. /package/modules/{read → export}/readSheetNamesNode.js +0 -0
  200. /package/modules/{read → xlsx}/coordinates.js +0 -0
  201. /package/modules/{read → xlsx}/dropEmptyColumns.js +0 -0
  202. /package/modules/{read → xlsx}/dropEmptyRows.js +0 -0
  203. /package/modules/{read → xlsx}/getData.js +0 -0
  204. /package/modules/{read → xlsx}/isDateTimestamp.js +0 -0
  205. /package/modules/{read → xlsx}/parseCell.js +0 -0
  206. /package/modules/{read → xlsx}/parseCellValue.js +0 -0
  207. /package/modules/{read → xlsx}/parseCells.js +0 -0
  208. /package/modules/{read → xlsx}/parseDate.js +0 -0
  209. /package/modules/{read → xlsx}/parseDimensions.js +0 -0
  210. /package/modules/{read → xlsx}/parseFilePaths.js +0 -0
  211. /package/modules/{read → xlsx}/parseProperties.js +0 -0
  212. /package/modules/{read → xlsx}/parseSharedStrings.js +0 -0
  213. /package/modules/{read → xlsx}/parseSheet.js +0 -0
  214. /package/modules/{read → xlsx}/parseStyles.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"getData.js","names":["_dropEmptyRows","_interopRequireDefault","require","_dropEmptyColumns","obj","__esModule","_createForOfIteratorHelperLoose","o","allowArrayLike","it","Symbol","iterator","call","next","bind","Array","isArray","_unsupportedIterableToArray","length","i","done","value","TypeError","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_nonIterableRest","minLen","_arrayLikeToArray","n","Object","prototype","toString","slice","constructor","name","from","test","len","arr2","r","l","t","e","u","a","f","push","getData","sheet","options","dimensions","cells","_dimensions","leftTop","rightBottom","colsCount","column","rowsCount","row","data","j","_iterator","_step","cell","rowIndex","columnIndex","rowIndexSourceMap","dropEmptyRows","dropEmptyColumns","onlyTrimAtTheEnd","transformData"],"sources":["../../source/read/getData.js"],"sourcesContent":["import dropEmptyRows from './dropEmptyRows.js'\r\nimport dropEmptyColumns from './dropEmptyColumns.js'\r\n\r\nexport default function getData(sheet, options) {\r\n const { dimensions, cells } = sheet\r\n\r\n // If the sheet is empty.\r\n if (cells.length === 0) {\r\n return []\r\n }\r\n\r\n const [leftTop, rightBottom] = dimensions\r\n\r\n // Don't discard empty rows or columns at the start of the spreadsheet,\r\n // even when the `*.xlsx` file itself tells that the content starts at an offset.\r\n // https://github.com/catamphetamine/read-excel-file/issues/102\r\n // const colsCount = (rightBottom.column - leftTop.column) + 1\r\n // const rowsCount = (rightBottom.row - leftTop.row) + 1\r\n\r\n const colsCount = rightBottom.column\r\n const rowsCount = rightBottom.row\r\n\r\n // Initialize spreadsheet data structure.\r\n let data = new Array(rowsCount)\r\n let i = 0\r\n while (i < rowsCount) {\r\n data[i] = new Array(colsCount)\r\n let j = 0\r\n while (j < colsCount) {\r\n data[i][j] = null\r\n j++\r\n }\r\n i++\r\n }\r\n\r\n // Fill in spreadsheet `data`.\r\n // (this code implies that `cells` aren't necessarily sorted by row and column:\r\n // maybe that's not correct, this piece code was initially copy-pasted\r\n // from some other library that used `XPath`)\r\n for (const cell of cells) {\r\n // Don't discard empty rows or columns at the start of the spreadsheet,\r\n // even when the `*.xlsx` file itself tells that the content starts at an offset.\r\n // https://github.com/catamphetamine/read-excel-file/issues/102\r\n // const rowIndex = cell.row - leftTop.row\r\n // const columnIndex = cell.column - leftTop.column\r\n const rowIndex = cell.row - 1\r\n const columnIndex = cell.column - 1\r\n // Ignore the data in the cell if it's outside of the spreadsheet's \"dimensions\".\r\n if (columnIndex < colsCount && rowIndex < rowsCount) {\r\n data[rowIndex][columnIndex] = cell.value\r\n }\r\n }\r\n\r\n // Fill in the row map.\r\n const { rowIndexSourceMap } = options\r\n if (rowIndexSourceMap) {\r\n let i = 0\r\n while (i < data.length) {\r\n rowIndexSourceMap[i] = i\r\n i++\r\n }\r\n }\r\n\r\n // Drop (discard) empty columns or rows.\r\n //\r\n // Don't discard empty rows or columns at the start or in the middle.\r\n // Only discard empty rows at the bottom or empty columns on the right side.\r\n // The rationale is that the data should be output in the same shape or form\r\n // as it can be seen in the actual spreadsheet.\r\n // If the user decides to discard empty rows or columns, they could do it manually\r\n // by passing `transformData()` function as an option.\r\n //\r\n data = dropEmptyRows(\r\n dropEmptyColumns(data, { onlyTrimAtTheEnd: true }),\r\n { onlyTrimAtTheEnd: true, rowIndexSourceMap }\r\n )\r\n\r\n // Optionally transform data before applying `schema`.\r\n if (options.transformData) {\r\n data = options.transformData(data)\r\n // data = options.transformData(data, {\r\n // dropEmptyRowsAndColumns(data) {\r\n // return dropEmptyRows(dropEmptyColumns(data), { rowIndexSourceMap })\r\n // }\r\n // })\r\n }\r\n\r\n return data\r\n}"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAoD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,gCAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,oBAAAE,EAAA,UAAAA,EAAA,GAAAA,EAAA,CAAAG,IAAA,CAAAL,CAAA,GAAAM,IAAA,CAAAC,IAAA,CAAAL,EAAA,OAAAM,KAAA,CAAAC,OAAA,CAAAT,CAAA,MAAAE,EAAA,GAAAQ,2BAAA,CAAAV,CAAA,MAAAC,cAAA,IAAAD,CAAA,WAAAA,CAAA,CAAAW,MAAA,qBAAAT,EAAA,EAAAF,CAAA,GAAAE,EAAA,MAAAU,CAAA,+BAAAA,CAAA,IAAAZ,CAAA,CAAAW,MAAA,WAAAE,IAAA,mBAAAA,IAAA,SAAAC,KAAA,EAAAd,CAAA,CAAAY,CAAA,sBAAAG,SAAA;AAAA,SAAAC,eAAAC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AAGV,OAAO,CAACqB,aAAa,CAACX,IAAI,CAAC;IAClC;IACA;IACA;IACA;IACA;EACF;;EAEA,OAAOA,IAAI;AACb"}
1
+ {"version":3,"file":"getData.js","names":["_dropEmptyRows","_interopRequireDefault","require","_dropEmptyColumns","obj","__esModule","_createForOfIteratorHelperLoose","o","allowArrayLike","it","Symbol","iterator","call","next","bind","Array","isArray","_unsupportedIterableToArray","length","i","done","value","TypeError","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_nonIterableRest","minLen","_arrayLikeToArray","n","Object","prototype","toString","slice","constructor","name","from","test","len","arr2","r","l","t","e","u","a","f","push","getData","sheet","options","dimensions","cells","_dimensions","leftTop","rightBottom","colsCount","column","rowsCount","row","data","j","_iterator","_step","cell","rowIndex","columnIndex","rowIndexSourceMap","dropEmptyRows","dropEmptyColumns","onlyTrimAtTheEnd","transformData"],"sources":["../../source/xlsx/getData.js"],"sourcesContent":["import dropEmptyRows from './dropEmptyRows.js'\r\nimport dropEmptyColumns from './dropEmptyColumns.js'\r\n\r\nexport default function getData(sheet, options) {\r\n const { dimensions, cells } = sheet\r\n\r\n // If the sheet is empty.\r\n if (cells.length === 0) {\r\n return []\r\n }\r\n\r\n const [leftTop, rightBottom] = dimensions\r\n\r\n // Don't discard empty rows or columns at the start of the spreadsheet,\r\n // even when the `*.xlsx` file itself tells that the content starts at an offset.\r\n // https://github.com/catamphetamine/read-excel-file/issues/102\r\n // const colsCount = (rightBottom.column - leftTop.column) + 1\r\n // const rowsCount = (rightBottom.row - leftTop.row) + 1\r\n\r\n const colsCount = rightBottom.column\r\n const rowsCount = rightBottom.row\r\n\r\n // Initialize spreadsheet data structure.\r\n let data = new Array(rowsCount)\r\n let i = 0\r\n while (i < rowsCount) {\r\n data[i] = new Array(colsCount)\r\n let j = 0\r\n while (j < colsCount) {\r\n data[i][j] = null\r\n j++\r\n }\r\n i++\r\n }\r\n\r\n // Fill in spreadsheet `data`.\r\n // (this code implies that `cells` aren't necessarily sorted by row and column:\r\n // maybe that's not correct, this piece code was initially copy-pasted\r\n // from some other library that used `XPath`)\r\n for (const cell of cells) {\r\n // Don't discard empty rows or columns at the start of the spreadsheet,\r\n // even when the `*.xlsx` file itself tells that the content starts at an offset.\r\n // https://github.com/catamphetamine/read-excel-file/issues/102\r\n // const rowIndex = cell.row - leftTop.row\r\n // const columnIndex = cell.column - leftTop.column\r\n const rowIndex = cell.row - 1\r\n const columnIndex = cell.column - 1\r\n // Ignore the data in the cell if it's outside of the spreadsheet's \"dimensions\".\r\n if (columnIndex < colsCount && rowIndex < rowsCount) {\r\n data[rowIndex][columnIndex] = cell.value\r\n }\r\n }\r\n\r\n // Fill in the row map.\r\n const { rowIndexSourceMap } = options\r\n if (rowIndexSourceMap) {\r\n let i = 0\r\n while (i < data.length) {\r\n rowIndexSourceMap[i] = i\r\n i++\r\n }\r\n }\r\n\r\n // Drop (discard) empty columns or rows.\r\n //\r\n // Don't discard empty rows or columns at the start or in the middle.\r\n // Only discard empty rows at the bottom or empty columns on the right side.\r\n // The rationale is that the data should be output in the same shape or form\r\n // as it can be seen in the actual spreadsheet.\r\n // If the user decides to discard empty rows or columns, they could do it manually\r\n // by passing `transformData()` function as an option.\r\n //\r\n data = dropEmptyRows(\r\n dropEmptyColumns(data, { onlyTrimAtTheEnd: true }),\r\n { onlyTrimAtTheEnd: true, rowIndexSourceMap }\r\n )\r\n\r\n // Optionally transform data before applying `schema`.\r\n if (options.transformData) {\r\n data = options.transformData(data)\r\n // data = options.transformData(data, {\r\n // dropEmptyRowsAndColumns(data) {\r\n // return dropEmptyRows(dropEmptyColumns(data), { rowIndexSourceMap })\r\n // }\r\n // })\r\n }\r\n\r\n return data\r\n}"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAoD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,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AAI,CAAC5C,KAAK;IAC1C;EACF;;EAEA;EACA,IAAQ+C,iBAAiB,GAAKjB,OAAO,CAA7BiB,iBAAiB;EACzB,IAAIA,iBAAiB,EAAE;IACrB,IAAIjD,EAAC,GAAG,CAAC;IACT,OAAOA,EAAC,GAAG0C,IAAI,CAAC3C,MAAM,EAAE;MACtBkD,iBAAiB,CAACjD,EAAC,CAAC,GAAGA,EAAC;MACxBA,EAAC,EAAE;IACL;EACF;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA0C,IAAI,GAAG,IAAAQ,yBAAa,EAClB,IAAAC,4BAAgB,EAACT,IAAI,EAAE;IAAEU,gBAAgB,EAAE;EAAK,CAAC,CAAC,EAClD;IAAEA,gBAAgB,EAAE,IAAI;IAAEH,iBAAiB,EAAjBA;EAAkB,CAC9C,CAAC;;EAED;EACA,IAAIjB,OAAO,CAACqB,aAAa,EAAE;IACzBX,IAAI,GAAGV,OAAO,CAACqB,aAAa,CAACX,IAAI,CAAC;IAClC;IACA;IACA;IACA;IACA;EACF;;EAEA,OAAOA,IAAI;AACb"}
@@ -1 +1 @@
1
- {"version":3,"file":"isDateTimestamp.js","names":["isDateTimestamp","styleId","styles","options","style","Error","concat","numberFormat","BUILT_IN_DATE_NUMBER_FORMAT_IDS","indexOf","Number","id","dateFormat","template","smartDateParser","isDateTemplate","DATE_FORMAT_WEIRD_PREFIX","DATE_FORMAT_WEIRD_POSTFIX","toLowerCase","replace","tokens","split","_iterator","_createForOfIteratorHelperLoose","_step","done","token","value","DATE_TEMPLATE_TOKENS"],"sources":["../../source/read/isDateTimestamp.js"],"sourcesContent":["// XLSX does have \"d\" type for dates, but it's not commonly used.\r\n// Instead, it prefers using \"n\" type for storing dates as timestamps.\r\n//\r\n// Whether a numeric value is a number or a date timestamp, it sometimes could be\r\n// detected by looking at the value \"format\" and seeing if it's a date-specific one.\r\n// https://github.com/catamphetamine/read-excel-file/issues/3#issuecomment-395770777\r\n//\r\n// The list of generic numeric value \"formats\":\r\n// https://xlsxwriter.readthedocs.io/format.html#format-set-num-format\r\n//\r\nexport default function isDateTimestamp(styleId, styles, options) {\r\n if (styleId) {\r\n const style = styles[styleId]\r\n if (!style) {\r\n throw new Error(`Cell style not found: ${styleId}`)\r\n }\r\n if (!style.numberFormat) {\r\n return false\r\n }\r\n if (\r\n // Whether it's a \"number format\" that's conventionally used for storing date timestamps.\r\n BUILT_IN_DATE_NUMBER_FORMAT_IDS.indexOf(Number(style.numberFormat.id)) >= 0 ||\r\n // Whether it's a \"number format\" that uses a \"formatting template\"\r\n // that the developer is certain is a date formatting template.\r\n (options.dateFormat && style.numberFormat.template === options.dateFormat) ||\r\n // Whether the \"smart formatting template\" feature is not disabled\r\n // and it has detected that it's a date formatting template by looking at it.\r\n (options.smartDateParser !== false && style.numberFormat.template && isDateTemplate(style.numberFormat.template))\r\n ) {\r\n return true\r\n }\r\n }\r\n}\r\n\r\n// https://hexdocs.pm/xlsxir/number_styles.html\r\nconst BUILT_IN_DATE_NUMBER_FORMAT_IDS = [14,15,16,17,18,19,20,21,22,27,30,36,45,46,47,50,57]\r\n\r\n// On some date formats, there's an \"[$-414]\" prefix.\r\n// I don't have any idea what that is.\r\n//\r\n// https://stackoverflow.com/questions/4730152/what-indicates-an-office-open-xml-cell-contains-a-date-time-value\r\n//\r\n// Examples:\r\n//\r\n// * 27 (built-in format) \"[$-404]e/m/d\"\r\n// * 164 (custom format) \"[$-414]mmmm\\ yyyy;@\"\r\n//\r\nconst DATE_FORMAT_WEIRD_PREFIX = /^\\[\\$-414\\]/\r\n\r\n// On some date formats, there's an \";@\" postfix.\r\n// I don't have any idea what that is.\r\n// Examples:\r\n//\r\n// * 164 (custom format) \"m/d/yyyy;@\"\r\n// * 164 (custom format) \"[$-414]mmmm\\ yyyy;@\"\r\n//\r\nconst DATE_FORMAT_WEIRD_POSTFIX = /;@$/\r\n\r\nfunction isDateTemplate(template) {\r\n // Date format tokens could be in upper case or in lower case.\r\n // There seems to be no single standard.\r\n // So lowercase the template first.\r\n template = template.toLowerCase()\r\n\r\n // On some date formats, there's an \"[$-414]\" prefix.\r\n // I don't have any idea what that is. Trim it.\r\n template = template.replace(DATE_FORMAT_WEIRD_PREFIX, '')\r\n\r\n // On some date formats, there's an \";@\" postfix.\r\n // I don't have any idea what that is. Trim it.\r\n template = template.replace(DATE_FORMAT_WEIRD_POSTFIX, '')\r\n\r\n const tokens = template.split(/\\W+/)\r\n for (const token of tokens) {\r\n if (DATE_TEMPLATE_TOKENS.indexOf(token) < 0) {\r\n return false\r\n }\r\n }\r\n return true\r\n}\r\n\r\n// These tokens could be in upper case or in lower case.\r\n// There seems to be no single standard, so using lower case.\r\nconst DATE_TEMPLATE_TOKENS = [\r\n // Seconds (min two digits). Example: \"05\".\r\n 'ss',\r\n // Minutes (min two digits). Example: \"05\". Could also be \"Months\". Weird.\r\n 'mm',\r\n // Hours. Example: \"1\".\r\n 'h',\r\n // Hours (min two digits). Example: \"01\".\r\n 'hh',\r\n // \"AM\" part of \"AM/PM\". Lowercased just in case.\r\n 'am',\r\n // \"PM\" part of \"AM/PM\". Lowercased just in case.\r\n 'pm',\r\n // Day. Example: \"1\"\r\n 'd',\r\n // Day (min two digits). Example: \"01\"\r\n 'dd',\r\n // Month (numeric). Example: \"1\".\r\n 'm',\r\n // Month (numeric, min two digits). Example: \"01\". Could also be \"Minutes\". Weird.\r\n 'mm',\r\n // Month (shortened month name). Example: \"Jan\".\r\n 'mmm',\r\n // Month (full month name). Example: \"January\".\r\n 'mmmm',\r\n // Two-digit year. Example: \"20\".\r\n 'yy',\r\n // Full year. Example: \"2020\".\r\n 'yyyy',\r\n\r\n // I don't have any idea what \"e\" means.\r\n // It's used in \"built-in\" XLSX formats:\r\n // * 27 '[$-404]e/m/d';\r\n // * 36 '[$-404]e/m/d';\r\n // * 50 '[$-404]e/m/d';\r\n // * 57 '[$-404]e/m/d';\r\n 'e'\r\n];"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA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ACAL,QAAQ,GAAGA,QAAQ,CAACM,OAAO,CAACH,wBAAwB,EAAE,EAAE,CAAC;;EAEzD;EACA;EACAH,QAAQ,GAAGA,QAAQ,CAACM,OAAO,CAACF,yBAAyB,EAAE,EAAE,CAAC;EAE1D,IAAMG,MAAM,GAAGP,QAAQ,CAACQ,KAAK,CAAC,KAAK,CAAC;EACpC,SAAAC,SAAA,GAAAC,+BAAA,CAAoBH,MAAM,GAAAI,KAAA,IAAAA,KAAA,GAAAF,SAAA,IAAAG,IAAA,GAAE;IAAA,IAAjBC,KAAK,GAAAF,KAAA,CAAAG,KAAA;IACd,IAAIC,oBAAoB,CAACnB,OAAO,CAACiB,KAAK,CAAC,GAAG,CAAC,EAAE;MAC3C,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb;;AAEA;AACA;AACA,IAAME,oBAAoB,GAAG;AAC3B;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,KAAK;AACL;AACA,MAAM;AACN;AACA,IAAI;AACJ;AACA,MAAM;AAEN;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,CACJ"}
1
+ {"version":3,"file":"isDateTimestamp.js","names":["isDateTimestamp","styleId","styles","options","style","Error","concat","numberFormat","BUILT_IN_DATE_NUMBER_FORMAT_IDS","indexOf","Number","id","dateFormat","template","smartDateParser","isDateTemplate","DATE_FORMAT_WEIRD_PREFIX","DATE_FORMAT_WEIRD_POSTFIX","toLowerCase","replace","tokens","split","_iterator","_createForOfIteratorHelperLoose","_step","done","token","value","DATE_TEMPLATE_TOKENS"],"sources":["../../source/xlsx/isDateTimestamp.js"],"sourcesContent":["// XLSX does have \"d\" type for dates, but it's not commonly used.\r\n// Instead, it prefers using \"n\" type for storing dates as timestamps.\r\n//\r\n// Whether a numeric value is a number or a date timestamp, it sometimes could be\r\n// detected by looking at the value \"format\" and seeing if it's a date-specific one.\r\n// https://github.com/catamphetamine/read-excel-file/issues/3#issuecomment-395770777\r\n//\r\n// The list of generic numeric value \"formats\":\r\n// https://xlsxwriter.readthedocs.io/format.html#format-set-num-format\r\n//\r\nexport default function isDateTimestamp(styleId, styles, options) {\r\n if (styleId) {\r\n const style = styles[styleId]\r\n if (!style) {\r\n throw new Error(`Cell style not found: ${styleId}`)\r\n }\r\n if (!style.numberFormat) {\r\n return false\r\n }\r\n if (\r\n // Whether it's a \"number format\" that's conventionally used for storing date timestamps.\r\n BUILT_IN_DATE_NUMBER_FORMAT_IDS.indexOf(Number(style.numberFormat.id)) >= 0 ||\r\n // Whether it's a \"number format\" that uses a \"formatting template\"\r\n // that the developer is certain is a date formatting template.\r\n (options.dateFormat && style.numberFormat.template === options.dateFormat) ||\r\n // Whether the \"smart formatting template\" feature is not disabled\r\n // and it has detected that it's a date formatting template by looking at it.\r\n (options.smartDateParser !== false && style.numberFormat.template && isDateTemplate(style.numberFormat.template))\r\n ) {\r\n return true\r\n }\r\n }\r\n}\r\n\r\n// https://hexdocs.pm/xlsxir/number_styles.html\r\nconst BUILT_IN_DATE_NUMBER_FORMAT_IDS = [14,15,16,17,18,19,20,21,22,27,30,36,45,46,47,50,57]\r\n\r\n// On some date formats, there's an \"[$-414]\" prefix.\r\n// I don't have any idea what that is.\r\n//\r\n// https://stackoverflow.com/questions/4730152/what-indicates-an-office-open-xml-cell-contains-a-date-time-value\r\n//\r\n// Examples:\r\n//\r\n// * 27 (built-in format) \"[$-404]e/m/d\"\r\n// * 164 (custom format) \"[$-414]mmmm\\ yyyy;@\"\r\n//\r\nconst DATE_FORMAT_WEIRD_PREFIX = /^\\[\\$-414\\]/\r\n\r\n// On some date formats, there's an \";@\" postfix.\r\n// I don't have any idea what that is.\r\n// Examples:\r\n//\r\n// * 164 (custom format) \"m/d/yyyy;@\"\r\n// * 164 (custom format) \"[$-414]mmmm\\ yyyy;@\"\r\n//\r\nconst DATE_FORMAT_WEIRD_POSTFIX = /;@$/\r\n\r\nfunction isDateTemplate(template) {\r\n // Date format tokens could be in upper case or in lower case.\r\n // There seems to be no single standard.\r\n // So lowercase the template first.\r\n template = template.toLowerCase()\r\n\r\n // On some date formats, there's an \"[$-414]\" prefix.\r\n // I don't have any idea what that is. Trim it.\r\n template = template.replace(DATE_FORMAT_WEIRD_PREFIX, '')\r\n\r\n // On some date formats, there's an \";@\" postfix.\r\n // I don't have any idea what that is. Trim it.\r\n template = template.replace(DATE_FORMAT_WEIRD_POSTFIX, '')\r\n\r\n const tokens = template.split(/\\W+/)\r\n for (const token of tokens) {\r\n if (DATE_TEMPLATE_TOKENS.indexOf(token) < 0) {\r\n return false\r\n }\r\n }\r\n return true\r\n}\r\n\r\n// These tokens could be in upper case or in lower case.\r\n// There seems to be no single standard, so using lower case.\r\nconst DATE_TEMPLATE_TOKENS = [\r\n // Seconds (min two digits). Example: \"05\".\r\n 'ss',\r\n // Minutes (min two digits). Example: \"05\". Could also be \"Months\". Weird.\r\n 'mm',\r\n // Hours. Example: \"1\".\r\n 'h',\r\n // Hours (min two digits). Example: \"01\".\r\n 'hh',\r\n // \"AM\" part of \"AM/PM\". Lowercased just in case.\r\n 'am',\r\n // \"PM\" part of \"AM/PM\". Lowercased just in case.\r\n 'pm',\r\n // Day. Example: \"1\"\r\n 'd',\r\n // Day (min two digits). Example: \"01\"\r\n 'dd',\r\n // Month (numeric). Example: \"1\".\r\n 'm',\r\n // Month (numeric, min two digits). Example: \"01\". Could also be \"Minutes\". Weird.\r\n 'mm',\r\n // Month (shortened month name). Example: \"Jan\".\r\n 'mmm',\r\n // Month (full month name). Example: \"January\".\r\n 'mmmm',\r\n // Two-digit year. Example: \"20\".\r\n 'yy',\r\n // Full year. Example: \"2020\".\r\n 'yyyy',\r\n\r\n // I don't have any idea what \"e\" means.\r\n // It's used in \"built-in\" XLSX formats:\r\n // * 27 '[$-404]e/m/d';\r\n // * 36 '[$-404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;AAEvC,SAASF,cAAcA,CAACF,QAAQ,EAAE;EAChC;EACA;EACA;EACAA,QAAQ,GAAGA,QAAQ,CAACK,WAAW,CAAC,CAAC;;EAEjC;EACA;EACAL,QAAQ,GAAGA,QAAQ,CAACM,OAAO,CAACH,wBAAwB,EAAE,EAAE,CAAC;;EAEzD;EACA;EACAH,QAAQ,GAAGA,QAAQ,CAACM,OAAO,CAACF,yBAAyB,EAAE,EAAE,CAAC;EAE1D,IAAMG,MAAM,GAAGP,QAAQ,CAACQ,KAAK,CAAC,KAAK,CAAC;EACpC,SAAAC,SAAA,GAAAC,+BAAA,CAAoBH,MAAM,GAAAI,KAAA,IAAAA,KAAA,GAAAF,SAAA,IAAAG,IAAA,GAAE;IAAA,IAAjBC,KAAK,GAAAF,KAAA,CAAAG,KAAA;IACd,IAAIC,oBAAoB,CAACnB,OAAO,CAACiB,KAAK,CAAC,GAAG,CAAC,EAAE;MAC3C,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb;;AAEA;AACA;AACA,IAAME,oBAAoB,GAAG;AAC3B;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,KAAK;AACL;AACA,MAAM;AACN;AACA,IAAI;AACJ;AACA,MAAM;AAEN;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseCell.js","names":["_parseCellValue","_interopRequireDefault","require","_coordinates","_xlsx","_dom","obj","__esModule","parseCell","node","sheet","xml","values","styles","properties","options","coords","parseCellCoordinates","getAttribute","valueElement","getCellValue","value","textContent","type","hasAttribute","row","column","parseCellValue","getInlineStringValue","getCellInlineStringValue","getInlineStringXml","getOuterXml","getStyleId"],"sources":["../../source/read/parseCell.js"],"sourcesContent":["import parseCellValue from './parseCellValue.js'\r\n\r\nimport {\r\n parseCellCoordinates\r\n} from './coordinates.js'\r\n\r\nimport {\r\n getCellValue,\r\n getCellInlineStringValue\r\n} from '../xml/xlsx.js'\r\n\r\nimport {\r\n getOuterXml\r\n} from '../xml/dom.js'\r\n\r\n// Example of a `<c/>`ell element:\r\n//\r\n// <c>\r\n// <f>string</f> — formula.\r\n// <v>string</v> — formula pre-computed value.\r\n// <is>\r\n// <t>string</t> — an `inlineStr` string (rather than a \"common string\" from a dictionary).\r\n// <r>\r\n// <rPr>\r\n// ...\r\n// </rPr>\r\n// <t>string</t>\r\n// </r>\r\n// <rPh sb=\"1\" eb=\"1\">\r\n// <t>string</t>\r\n// </rPh>\r\n// <phoneticPr fontId=\"1\"/>\r\n// </is>\r\n// <extLst>\r\n// <ext>\r\n// <!--any element-->\r\n// </ext>\r\n// </extLst>\r\n// </c>\r\n//\r\nexport default function parseCell(node, sheet, xml, values, styles, properties, options) {\r\n const coords = parseCellCoordinates(node.getAttribute('r'))\r\n\r\n const valueElement = getCellValue(sheet, node)\r\n\r\n // For `xpath`, `value` can be `undefined` while for native `DOMParser` it's `null`.\r\n // So using `value && ...` instead of `if (value !== undefined) { ... }` here\r\n // for uniform compatibility with both `xpath` and native `DOMParser`.\r\n let value = valueElement && valueElement.textContent\r\n\r\n let type\r\n if (node.hasAttribute('t')) {\r\n type = node.getAttribute('t')\r\n }\r\n\r\n return {\r\n row: coords[0],\r\n column: coords[1],\r\n value: parseCellValue(value, type, {\r\n getInlineStringValue: () => getCellInlineStringValue(sheet, node),\r\n getInlineStringXml: () => getOuterXml(node),\r\n getStyleId: () => node.getAttribute('s'),\r\n styles,\r\n values,\r\n properties,\r\n options\r\n })\r\n }\r\n}"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AAEsB,SAAA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ACF,CAAC;EACH,CAAC;AACH"}
1
+ {"version":3,"file":"parseCell.js","names":["_parseCellValue","_interopRequireDefault","require","_coordinates","_xlsx","_dom","obj","__esModule","parseCell","node","sheet","xml","values","styles","properties","options","coords","parseCellCoordinates","getAttribute","valueElement","getCellValue","value","textContent","type","hasAttribute","row","column","parseCellValue","getInlineStringValue","getCellInlineStringValue","getInlineStringXml","getOuterXml","getStyleId"],"sources":["../../source/xlsx/parseCell.js"],"sourcesContent":["import parseCellValue from './parseCellValue.js'\r\n\r\nimport {\r\n parseCellCoordinates\r\n} from './coordinates.js'\r\n\r\nimport {\r\n getCellValue,\r\n getCellInlineStringValue\r\n} from '../xml/xlsx.js'\r\n\r\nimport {\r\n getOuterXml\r\n} from '../xml/dom.js'\r\n\r\n// Example of a `<c/>`ell element:\r\n//\r\n// <c>\r\n// <f>string</f> — formula.\r\n// <v>string</v> — formula pre-computed value.\r\n// <is>\r\n// <t>string</t> — an `inlineStr` string (rather than a \"common string\" from a dictionary).\r\n// <r>\r\n// <rPr>\r\n// ...\r\n// </rPr>\r\n// <t>string</t>\r\n// </r>\r\n// <rPh sb=\"1\" eb=\"1\">\r\n// <t>string</t>\r\n// </rPh>\r\n// <phoneticPr fontId=\"1\"/>\r\n// </is>\r\n// <extLst>\r\n// <ext>\r\n// <!--any element-->\r\n// </ext>\r\n// </extLst>\r\n// </c>\r\n//\r\nexport default function parseCell(node, sheet, xml, values, styles, properties, options) {\r\n const coords = parseCellCoordinates(node.getAttribute('r'))\r\n\r\n const valueElement = getCellValue(sheet, node)\r\n\r\n // For `xpath`, `value` can be `undefined` while for native `DOMParser` it's `null`.\r\n // So using `value && ...` instead of `if (value !== undefined) { ... }` here\r\n // for uniform compatibility with both `xpath` and native `DOMParser`.\r\n let value = valueElement && valueElement.textContent\r\n\r\n let type\r\n if (node.hasAttribute('t')) {\r\n type = node.getAttribute('t')\r\n }\r\n\r\n return {\r\n row: coords[0],\r\n column: coords[1],\r\n value: parseCellValue(value, type, {\r\n getInlineStringValue: () => getCellInlineStringValue(sheet, node),\r\n getInlineStringXml: () => getOuterXml(node),\r\n getStyleId: () => node.getAttribute('s'),\r\n styles,\r\n values,\r\n properties,\r\n options\r\n })\r\n }\r\n}"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AAEsB,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,SAASA,CAACC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE;EACvF,IAAMC,MAAM,GAAG,IAAAC,iCAAoB,EAACR,IAAI,CAACS,YAAY,CAAC,GAAG,CAAC,CAAC;EAE3D,IAAMC,YAAY,GAAG,IAAAC,kBAAY,EAACV,KAAK,EAAED,IAAI,CAAC;;EAE9C;EACA;EACA;EACA,IAAIY,KAAK,GAAGF,YAAY,IAAIA,YAAY,CAACG,WAAW;EAEpD,IAAIC,IAAI;EACR,IAAId,IAAI,CAACe,YAAY,CAAC,GAAG,CAAC,EAAE;IAC1BD,IAAI,GAAGd,IAAI,CAACS,YAAY,CAAC,GAAG,CAAC;EAC/B;EAEA,OAAO;IACLO,GAAG,EAAET,MAAM,CAAC,CAAC,CAAC;IACdU,MAAM,EAAEV,MAAM,CAAC,CAAC,CAAC;IACjBK,KAAK,EAAE,IAAAM,0BAAc,EAACN,KAAK,EAAEE,IAAI,EAAE;MACjCK,oBAAoB,EAAE,SAAAA,qBAAA;QAAA,OAAM,IAAAC,8BAAwB,EAACnB,KAAK,EAAED,IAAI,CAAC;MAAA;MACjEqB,kBAAkB,EAAE,SAAAA,mBAAA;QAAA,OAAM,IAAAC,gBAAW,EAACtB,IAAI,CAAC;MAAA;MAC3CuB,UAAU,EAAE,SAAAA,WAAA;QAAA,OAAMvB,IAAI,CAACS,YAAY,CAAC,GAAG,CAAC;MAAA;MACxCL,MAAM,EAANA,MAAM;MACND,MAAM,EAANA,MAAM;MACNE,UAAU,EAAVA,UAAU;MACVC,OAAO,EAAPA;IACF,CAAC;EACH,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseCellValue.js","names":["_parseDate","_interopRequireDefault","require","_isDateTimestamp","obj","__esModule","parseCellValue","value","type","_ref","getInlineStringValue","getInlineStringXml","getStyleId","styles","values","properties","options","parseString","undefined","Error","concat","sharedStringIndex","Number","isNaN","length","decodeError","parsedDate","Date","valueOf","isDateTimestampNumber","isDateTimestamp","parseNumberDefault","parseDate","parseNumber","TypeError","errorCode","trim","stringifiedNumber","parsedNumber"],"sources":["../../source/read/parseCellValue.js"],"sourcesContent":["import parseDate from './parseDate.js'\r\nimport isDateTimestamp from './isDateTimestamp.js'\r\n\r\n// Parses a string `value` of a cell.\r\nexport default function parseCellValue(value, type, {\r\n getInlineStringValue,\r\n getInlineStringXml,\r\n getStyleId,\r\n styles,\r\n values,\r\n properties,\r\n options\r\n}) {\r\n if (!type) {\r\n // Default cell type is \"n\" (numeric).\r\n // http://www.datypic.com/sc/ooxml/t-ssml_CT_Cell.html\r\n type = 'n'\r\n }\r\n\r\n // Available Excel cell types:\r\n // https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\r\n //\r\n // Some other document (seems to be old):\r\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html\r\n //\r\n switch (type) {\r\n // XLSX tends to store all strings as \"shared\" (indexed) ones\r\n // using \"s\" cell type (for saving on strage space).\r\n // \"str\" cell type is then generally only used for storing\r\n // formula-pre-calculated cell values.\r\n case 'str':\r\n value = parseString(value, options)\r\n break\r\n\r\n // Sometimes, XLSX stores strings as \"inline\" strings rather than \"shared\" (indexed) ones.\r\n // Perhaps the specification doesn't force it to use one or another.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"inlineStr\"><is><t>Test 123</t></is></c></row></sheetData>`.\r\n case 'inlineStr':\r\n value = getInlineStringValue()\r\n if (value === undefined) {\r\n throw new Error(`Unsupported \"inline string\" cell value structure: ${getInlineStringXml()}`)\r\n }\r\n value = parseString(value, options)\r\n break\r\n\r\n // XLSX tends to store string values as \"shared\" (indexed) ones.\r\n // \"Shared\" strings is a way for an Excel editor to reduce\r\n // the file size by storing \"commonly used\" strings in a dictionary\r\n // and then referring to such strings by their index in that dictionary.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"s\"><v>0</v></c></row></sheetData>`.\r\n case 's':\r\n // If a cell has no value then there's no `<c/>` element for it.\r\n // If a `<c/>` element exists then it's not empty.\r\n // The `<v/>`alue is a key in the \"shared strings\" dictionary of the\r\n // XLSX file, so look it up in the `values` dictionary by the numeric key.\r\n const sharedStringIndex = Number(value)\r\n if (isNaN(sharedStringIndex)) {\r\n throw new Error(`Invalid \"shared\" string index: ${value}`)\r\n }\r\n if (sharedStringIndex >= values.length) {\r\n throw new Error(`An out-of-bounds \"shared\" string index: ${value}`)\r\n }\r\n value = values[sharedStringIndex]\r\n value = parseString(value, options)\r\n break\r\n\r\n // Boolean (TRUE/FALSE) values are stored as either \"1\" or \"0\"\r\n // in cells of type \"b\".\r\n case 'b':\r\n if (value === '1') {\r\n value = true\r\n } else if (value === '0') {\r\n value = false\r\n } else {\r\n throw new Error(`Unsupported \"boolean\" cell value: ${value}`)\r\n }\r\n break\r\n\r\n // XLSX specification seems to support cells of type \"z\":\r\n // blank \"stub\" cells that should be ignored by data processing utilities.\r\n case 'z':\r\n value = undefined\r\n break\r\n\r\n // XLSX specification also defines cells of type \"e\" containing a numeric \"error\" code.\r\n // It's not clear what that means though.\r\n // They also wrote: \"and `w` property stores its common name\".\r\n // It's unclear what they meant by that.\r\n case 'e':\r\n value = decodeError(value)\r\n break\r\n\r\n // XLSX supports date cells of type \"d\", though seems like it (almost?) never\r\n // uses it for storing dates, preferring \"n\" numeric timestamp cells instead.\r\n // The value of a \"d\" cell is supposedly a string in \"ISO 8601\" format.\r\n // I haven't seen an XLSX file having such cells.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"d\"><v>2021-06-10T00:47:45.700Z</v></c></row></sheetData>`.\r\n case 'd':\r\n if (value === undefined) {\r\n break\r\n }\r\n const parsedDate = new Date(value)\r\n if (isNaN(parsedDate.valueOf())) {\r\n throw new Error(`Unsupported \"date\" cell value: ${value}`)\r\n }\r\n value = parsedDate\r\n break\r\n\r\n // Numeric cells have type \"n\".\r\n case 'n':\r\n if (value === undefined) {\r\n break\r\n }\r\n const isDateTimestampNumber = isDateTimestamp(getStyleId(), styles, options)\r\n // XLSX does have \"d\" type for dates, but it's not commonly used.\r\n // Instead, it prefers using \"n\" type for storing dates as timestamps.\r\n if (isDateTimestampNumber) {\r\n // Parse the number from string.\r\n value = parseNumberDefault(value)\r\n // Parse the number as a date timestamp.\r\n value = parseDate(value, properties)\r\n } else {\r\n // Parse the number from string.\r\n // Supports custom parsing function to work around javascript number encoding precision issues.\r\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/85\r\n value = (options.parseNumber || parseNumberDefault)(value)\r\n }\r\n break\r\n\r\n default:\r\n throw new TypeError(`Cell type not supported: ${type}`)\r\n }\r\n\r\n // Convert empty values to `null`.\r\n if (value === undefined) {\r\n value = null\r\n }\r\n\r\n return value\r\n}\r\n\r\n// Decodes numeric error code to a string code.\r\n// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\r\nfunction decodeError(errorCode) {\r\n // While the error values are determined by the application,\r\n // the following are some example error values that could be used:\r\n switch (errorCode) {\r\n case 0x00:\r\n return '#NULL!'\r\n case 0x07:\r\n return '#DIV/0!'\r\n case 0x0F:\r\n return '#VALUE!'\r\n case 0x17:\r\n return '#REF!'\r\n case 0x1D:\r\n return '#NAME?'\r\n case 0x24:\r\n return '#NUM!'\r\n case 0x2A:\r\n return '#N/A'\r\n case 0x2B:\r\n return '#GETTING_DATA'\r\n default:\r\n // Such error code doesn't exist. I made it up.\r\n return `#ERROR_${errorCode}`\r\n }\r\n}\r\n\r\nfunction parseString(value, options) {\r\n // In some weird cases, a developer might want to disable\r\n // the automatic trimming of all strings.\r\n // For example, leading spaces might express a tree-like hierarchy.\r\n // https://github.com/catamphetamine/read-excel-file/pull/106#issuecomment-1136062917\r\n if (options.trim !== false) {\r\n value = value.trim()\r\n }\r\n if (value === '') {\r\n value = undefined\r\n }\r\n return value\r\n}\r\n\r\n// Parses a number from string.\r\n// Throws an error if the number couldn't be parsed.\r\n// When parsing floating-point number, is affected by\r\n// the javascript number encoding precision issues:\r\n// https://www.youtube.com/watch?v=2gIxbTn7GSc\r\n// https://www.avioconsulting.com/blog/overcoming-javascript-numeric-precision-issues\r\nfunction parseNumberDefault(stringifiedNumber) {\r\n const parsedNumber = Number(stringifiedNumber)\r\n if (isNaN(parsedNumber)) {\r\n throw new Error(`Invalid \"numeric\" cell value: ${stringifiedNumber}`)\r\n }\r\n return parsedNumber\r\n}"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAkD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAElD;AACe,SAASE,cAAcA,CAACC,KAAK,EAAEC,IAAI,EAAAC,IAAA,EAQ/C;EAAA,IAPDC,oBAAoB,GAAAD,IAAA,CAApBC,oBAAoB;IACpBC,k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A,IAAID,KAAK,KAAKW,SAAS,EAAE;IACvBX,KAAK,GAAG,IAAI;EACd;EAEA,OAAOA,KAAK;AACd;;AAEA;AACA;AACA,SAASkB,WAAWA,CAACU,SAAS,EAAE;EAC9B;EACA;EACA,QAAQA,SAAS;IACf,KAAK,IAAI;MACP,OAAO,QAAQ;IACjB,KAAK,IAAI;MACP,OAAO,SAAS;IAClB,KAAK,IAAI;MACP,OAAO,SAAS;IAClB,KAAK,IAAI;MACP,OAAO,OAAO;IAChB,KAAK,IAAI;MACP,OAAO,QAAQ;IACjB,KAAK,IAAI;MACP,OAAO,OAAO;IAChB,KAAK,IAAI;MACP,OAAO,MAAM;IACf,KAAK,IAAI;MACP,OAAO,eAAe;IACxB;MACE;MACA,iBAAAf,MAAA,CAAiBe,SAAS;EAC9B;AACF;AAEA,SAASlB,WAAWA,CAACV,KAAK,EAAES,OAAO,EAAE;EACnC;EACA;EACA;EACA;EACA,IAAIA,OAAO,CAACoB,IAAI,KAAK,KAAK,EAAE;IAC1B7B,KAAK,GAAGA,KAAK,CAAC6B,IAAI,CAAC,CAAC;EACtB;EACA,IAAI7B,KAAK,KAAK,EAAE,EAAE;IAChBA,KAAK,GAAGW,SAAS;EACnB;EACA,OAAOX,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASwB,kBAAkBA,CAACM,iBAAiB,EAAE;EAC7C,IAAMC,YAAY,GAAGhB,MAAM,CAACe,iBAAiB,CAAC;EAC9C,IAAId,KAAK,CAACe,YAAY,CAAC,EAAE;IACvB,MAAM,IAAInB,KAAK,oCAAAC,MAAA,CAAkCiB,iBAAiB,CAAE,CAAC;EACvE;EACA,OAAOC,YAAY;AACrB"}
1
+ {"version":3,"file":"parseCellValue.js","names":["_parseDate","_interopRequireDefault","require","_isDateTimestamp","obj","__esModule","parseCellValue","value","type","_ref","getInlineStringValue","getInlineStringXml","getStyleId","styles","values","properties","options","parseString","undefined","Error","concat","sharedStringIndex","Number","isNaN","length","decodeError","parsedDate","Date","valueOf","isDateTimestampNumber","isDateTimestamp","parseNumberDefault","parseDate","parseNumber","TypeError","errorCode","trim","stringifiedNumber","parsedNumber"],"sources":["../../source/xlsx/parseCellValue.js"],"sourcesContent":["import parseDate from './parseDate.js'\r\nimport isDateTimestamp from './isDateTimestamp.js'\r\n\r\n// Parses a string `value` of a cell.\r\nexport default function parseCellValue(value, type, {\r\n getInlineStringValue,\r\n getInlineStringXml,\r\n getStyleId,\r\n styles,\r\n values,\r\n properties,\r\n options\r\n}) {\r\n if (!type) {\r\n // Default cell type is \"n\" (numeric).\r\n // http://www.datypic.com/sc/ooxml/t-ssml_CT_Cell.html\r\n type = 'n'\r\n }\r\n\r\n // Available Excel cell types:\r\n // https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\r\n //\r\n // Some other document (seems to be old):\r\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html\r\n //\r\n switch (type) {\r\n // XLSX tends to store all strings as \"shared\" (indexed) ones\r\n // using \"s\" cell type (for saving on strage space).\r\n // \"str\" cell type is then generally only used for storing\r\n // formula-pre-calculated cell values.\r\n case 'str':\r\n value = parseString(value, options)\r\n break\r\n\r\n // Sometimes, XLSX stores strings as \"inline\" strings rather than \"shared\" (indexed) ones.\r\n // Perhaps the specification doesn't force it to use one or another.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"inlineStr\"><is><t>Test 123</t></is></c></row></sheetData>`.\r\n case 'inlineStr':\r\n value = getInlineStringValue()\r\n if (value === undefined) {\r\n throw new Error(`Unsupported \"inline string\" cell value structure: ${getInlineStringXml()}`)\r\n }\r\n value = parseString(value, options)\r\n break\r\n\r\n // XLSX tends to store string values as \"shared\" (indexed) ones.\r\n // \"Shared\" strings is a way for an Excel editor to reduce\r\n // the file size by storing \"commonly used\" strings in a dictionary\r\n // and then referring to such strings by their index in that dictionary.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"s\"><v>0</v></c></row></sheetData>`.\r\n case 's':\r\n // If a cell has no value then there's no `<c/>` element for it.\r\n // If a `<c/>` element exists then it's not empty.\r\n // The `<v/>`alue is a key in the \"shared strings\" dictionary of the\r\n // XLSX file, so look it up in the `values` dictionary by the numeric key.\r\n const sharedStringIndex = Number(value)\r\n if (isNaN(sharedStringIndex)) {\r\n throw new Error(`Invalid \"shared\" string index: ${value}`)\r\n }\r\n if (sharedStringIndex >= values.length) {\r\n throw new Error(`An out-of-bounds \"shared\" string index: ${value}`)\r\n }\r\n value = values[sharedStringIndex]\r\n value = parseString(value, options)\r\n break\r\n\r\n // Boolean (TRUE/FALSE) values are stored as either \"1\" or \"0\"\r\n // in cells of type \"b\".\r\n case 'b':\r\n if (value === '1') {\r\n value = true\r\n } else if (value === '0') {\r\n value = false\r\n } else {\r\n throw new Error(`Unsupported \"boolean\" cell value: ${value}`)\r\n }\r\n break\r\n\r\n // XLSX specification seems to support cells of type \"z\":\r\n // blank \"stub\" cells that should be ignored by data processing utilities.\r\n case 'z':\r\n value = undefined\r\n break\r\n\r\n // XLSX specification also defines cells of type \"e\" containing a numeric \"error\" code.\r\n // It's not clear what that means though.\r\n // They also wrote: \"and `w` property stores its common name\".\r\n // It's unclear what they meant by that.\r\n case 'e':\r\n value = decodeError(value)\r\n break\r\n\r\n // XLSX supports date cells of type \"d\", though seems like it (almost?) never\r\n // uses it for storing dates, preferring \"n\" numeric timestamp cells instead.\r\n // The value of a \"d\" cell is supposedly a string in \"ISO 8601\" format.\r\n // I haven't seen an XLSX file having such cells.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"d\"><v>2021-06-10T00:47:45.700Z</v></c></row></sheetData>`.\r\n case 'd':\r\n if (value === undefined) {\r\n break\r\n }\r\n const parsedDate = new Date(value)\r\n if (isNaN(parsedDate.valueOf())) {\r\n throw new Error(`Unsupported \"date\" cell value: ${value}`)\r\n }\r\n value = parsedDate\r\n break\r\n\r\n // Numeric cells have type \"n\".\r\n case 'n':\r\n if (value === undefined) {\r\n break\r\n }\r\n const isDateTimestampNumber = isDateTimestamp(getStyleId(), styles, options)\r\n // XLSX does have \"d\" type for dates, but it's not commonly used.\r\n // Instead, it prefers using \"n\" type for storing dates as timestamps.\r\n if (isDateTimestampNumber) {\r\n // Parse the number from string.\r\n value = parseNumberDefault(value)\r\n // Parse the number as a date timestamp.\r\n value = parseDate(value, properties)\r\n } else {\r\n // Parse the number from string.\r\n // Supports custom parsing function to work around javascript number encoding precision issues.\r\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/85\r\n value = (options.parseNumber || parseNumberDefault)(value)\r\n }\r\n break\r\n\r\n default:\r\n throw new TypeError(`Cell type not supported: ${type}`)\r\n }\r\n\r\n // Convert empty values to `null`.\r\n if (value === undefined) {\r\n value = null\r\n }\r\n\r\n return value\r\n}\r\n\r\n// Decodes numeric error code to a string code.\r\n// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\r\nfunction decodeError(errorCode) {\r\n // While the error values are determined by the application,\r\n // the following are some example error values that could be used:\r\n switch (errorCode) {\r\n case 0x00:\r\n return '#NULL!'\r\n case 0x07:\r\n return '#DIV/0!'\r\n case 0x0F:\r\n return '#VALUE!'\r\n case 0x17:\r\n return '#REF!'\r\n case 0x1D:\r\n return '#NAME?'\r\n case 0x24:\r\n return '#NUM!'\r\n case 0x2A:\r\n return '#N/A'\r\n case 0x2B:\r\n return '#GETTING_DATA'\r\n default:\r\n // Such error code doesn't exist. I made it up.\r\n return `#ERROR_${errorCode}`\r\n }\r\n}\r\n\r\nfunction parseString(value, options) {\r\n // In some weird cases, a developer might want to disable\r\n // the automatic trimming of all strings.\r\n // For example, leading spaces might express a tree-like hierarchy.\r\n // https://github.com/catamphetamine/read-excel-file/pull/106#issuecomment-1136062917\r\n if (options.trim !== false) {\r\n value = value.trim()\r\n }\r\n if (value === '') {\r\n value = undefined\r\n }\r\n return value\r\n}\r\n\r\n// Parses a number from string.\r\n// Throws an error if the number couldn't be parsed.\r\n// When parsing floating-point number, is affected by\r\n// the javascript number encoding precision issues:\r\n// https://www.youtube.com/watch?v=2gIxbTn7GSc\r\n// https://www.avioconsulting.com/blog/overcoming-javascript-numeric-precision-issues\r\nfunction parseNumberDefault(stringifiedNumber) {\r\n const parsedNumber = Number(stringifiedNumber)\r\n if (isNaN(parsedNumber)) {\r\n throw new Error(`Invalid \"numeric\" cell value: ${stringifiedNumber}`)\r\n }\r\n return parsedNumber\r\n}"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAkD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAElD;AACe,SAASE,cAAcA,CAACC,KAAK,EAAEC,IAAI,EAAAC,IAAA,EAQ/C;EAAA,IAPDC,oBAAoB,GAAAD,IAAA,CAApBC,oBAAoB;IACpBC,kBAAkB,GAAAF,IAAA,CAAlBE,kBAAkB;IAClBC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,MAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,UAAU,GAAAN,IAAA,CAAVM,UAAU;IACVC,OAAO,GAAAP,IAAA,CAAPO,OAAO;EAEP,IAAI,CAACR,IAAI,EAAE;IACT;IACA;IACAA,IAAI,GAAG,GAAG;EACZ;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQA,IAAI;IACV;IACA;IACA;IACA;IACA,KAAK,KAAK;MACRD,KAAK,GAAGU,WAAW,CAACV,KAAK,EAAES,OAAO,CAAC;MACnC;;IAEF;IACA;IACA;IACA,KAAK,WAAW;MACdT,KAAK,GAAGG,oBAAoB,CAAC,CAAC;MAC9B,IA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KAAK,EAAES,OAAO,EAAE;EACnC;EACA;EACA;EACA;EACA,IAAIA,OAAO,CAACoB,IAAI,KAAK,KAAK,EAAE;IAC1B7B,KAAK,GAAGA,KAAK,CAAC6B,IAAI,CAAC,CAAC;EACtB;EACA,IAAI7B,KAAK,KAAK,EAAE,EAAE;IAChBA,KAAK,GAAGW,SAAS;EACnB;EACA,OAAOX,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASwB,kBAAkBA,CAACM,iBAAiB,EAAE;EAC7C,IAAMC,YAAY,GAAGhB,MAAM,CAACe,iBAAiB,CAAC;EAC9C,IAAId,KAAK,CAACe,YAAY,CAAC,EAAE;IACvB,MAAM,IAAInB,KAAK,oCAAAC,MAAA,CAAkCiB,iBAAiB,CAAE,CAAC;EACvE;EACA,OAAOC,YAAY;AACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseCells.js","names":["_parseCell","_interopRequireDefault","require","_xlsx","obj","__esModule","parseCells","sheet","xml","values","styles","properties","options","cells","getCells","length","map","node","parseCell"],"sources":["../../source/read/parseCells.js"],"sourcesContent":["import parseCell from './parseCell.js'\r\n\r\nimport {\r\n getCells,\r\n getMergedCells\r\n} from '../xml/xlsx.js'\r\n\r\nexport default function parseCells(sheet, xml, values, styles, properties, options) {\r\n const cells = getCells(sheet)\r\n\r\n if (cells.length === 0) {\r\n return []\r\n }\r\n\r\n // const mergedCells = getMergedCells(sheet)\r\n // for (const mergedCell of mergedCells) {\r\n // const [from, to] = mergedCell.split(':').map(parseCellCoordinates)\r\n // console.log('Merged Cell.', 'From:', from, 'To:', to)\r\n // }\r\n\r\n return cells.map((node) => {\r\n return parseCell(node, sheet, xml, values, styles, properties, options)\r\n })\r\n}"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAGuB,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAER,SAASE,UAAUA,CAACC,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE;EAClF,IAAMC,KAAK,GAAG,IAAAC,cAAQ,EAACP,KAAK,CAAC;EAE7B,IAAIM,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IACtB,OAAO,EAAE;EACX;;EAEA;EACA;EACA;EACA;EACA;;EAEA,OAAOF,KAAK,CAACG,GAAG,CAAC,UAACC,IAAI,EAAK;IACzB,OAAO,IAAAC,qBAAS,EAACD,IAAI,EAAEV,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,CAAC;EACzE,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"parseCells.js","names":["_parseCell","_interopRequireDefault","require","_xlsx","obj","__esModule","parseCells","sheet","xml","values","styles","properties","options","cells","getCells","length","map","node","parseCell"],"sources":["../../source/xlsx/parseCells.js"],"sourcesContent":["import parseCell from './parseCell.js'\r\n\r\nimport {\r\n getCells,\r\n getMergedCells\r\n} from '../xml/xlsx.js'\r\n\r\nexport default function parseCells(sheet, xml, values, styles, properties, options) {\r\n const cells = getCells(sheet)\r\n\r\n if (cells.length === 0) {\r\n return []\r\n }\r\n\r\n // const mergedCells = getMergedCells(sheet)\r\n // for (const mergedCell of mergedCells) {\r\n // const [from, to] = mergedCell.split(':').map(parseCellCoordinates)\r\n // console.log('Merged Cell.', 'From:', from, 'To:', to)\r\n // }\r\n\r\n return cells.map((node) => {\r\n return parseCell(node, sheet, xml, values, styles, properties, options)\r\n })\r\n}"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAGuB,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAER,SAASE,UAAUA,CAACC,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE;EAClF,IAAMC,KAAK,GAAG,IAAAC,cAAQ,EAACP,KAAK,CAAC;EAE7B,IAAIM,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IACtB,OAAO,EAAE;EACX;;EAEA;EACA;EACA;EACA;EACA;;EAEA,OAAOF,KAAK,CAACG,GAAG,CAAC,UAACC,IAAI,EAAK;IACzB,OAAO,IAAAC,qBAAS,EAACD,IAAI,EAAEV,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,CAAC;EACzE,CAAC,CAAC;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseDate.js","names":["parseExcelDate","excelSerialDate","options","epoch1904","daysBeforeUnixEpoch","hour","Date","Math","round"],"sources":["../../source/read/parseDate.js"],"sourcesContent":["// Parses an Excel Date (\"serial\") into a corresponding javascript Date in UTC+0 timezone.\r\n// (with time equal to 00:00)\r\n//\r\n// https://www.pcworld.com/article/3063622/software/mastering-excel-date-time-serial-numbers-networkdays-datevalue-and-more.html\r\n// \"If you need to calculate dates in your spreadsheets,\r\n// Excel uses its own unique system, which it calls Serial Numbers\".\r\n//\r\nexport default function parseExcelDate(excelSerialDate, options) {\r\n // https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel\r\n if (options && options.epoch1904) {\r\n excelSerialDate += 1462\r\n }\r\n\r\n // \"Excel serial date\" is just\r\n // the count of days since `01/01/1900`\r\n // (seems that it may be even fractional).\r\n //\r\n // The count of days elapsed\r\n // since `01/01/1900` (Excel epoch)\r\n // till `01/01/1970` (Unix epoch).\r\n // Accounts for leap years\r\n // (19 of them, yielding 19 extra days).\r\n const daysBeforeUnixEpoch = 70 * 365 + 19\r\n\r\n // An hour, approximately, because a minute\r\n // may be longer than 60 seconds, due to \"leap seconds\".\r\n //\r\n // Still, Javascript `Date` (and UNIX time in general) intentionally\r\n // drops the concept of \"leap seconds\" in order to make things simpler.\r\n // So it's fine.\r\n // https://stackoverflow.com/questions/53019726/where-are-the-leap-seconds-in-javascript\r\n //\r\n // \"The JavaScript Date object specifically adheres to the concept of Unix Time\r\n // (albeit with higher precision). This is part of the POSIX specification,\r\n // and thus is sometimes called \"POSIX Time\". It does not count leap seconds,\r\n // but rather assumes every day had exactly 86,400 seconds. You can read about\r\n // this in section 20.3.1.1 of the current ECMAScript specification, which states:\r\n //\r\n // \"Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC.\r\n // In time values leap seconds are ignored. It is assumed that there are exactly\r\n // 86,400,000 milliseconds per day.\"\r\n //\r\n // The fact is, that the unpredictable nature of leap seconds makes them very\r\n // difficult to work with in APIs. One can't generally pass timestamps around\r\n // that need leap seconds tables to be interpreted correctly, and expect that\r\n // one system will interpret them the same as another. For example, while your\r\n // example timestamp 1483228826 is 2017-01-01T00:00:00Z on your system,\r\n // it would be interpreted as 2017-01-01T00:00:26Z on POSIX based systems,\r\n // or systems without leap second tables. So they aren't portable.\r\n // Even on systems that have full updated tables, there's no telling what those\r\n // tables will contain in the future (beyond the 6-month IERS announcement period),\r\n // so I can't produce a future timestamp without risk that it may eventually change.\r\n //\r\n // To be clear - to support leap seconds in a programming language, the implementation\r\n // must go out of its way to do so, and must make tradeoffs that are not always acceptable.\r\n // Though there are exceptions, the general position is to not support them - not because\r\n // of any subversion or active countermeasures, but because supporting them properly is much,\r\n // much harder.\"\r\n //\r\n // https://en.wikipedia.org/wiki/Unix_time#Leap_seconds\r\n // https://en.wikipedia.org/wiki/Leap_year\r\n // https://en.wikipedia.org/wiki/Leap_second\r\n //\r\n const hour = 60 * 60 * 1000\r\n\r\n return new Date(Math.round((excelSerialDate - daysBeforeUnixEpoch) * 24 * hour))\r\n}"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAcA,CAACC,eAAe,EAAEC,OAAO,EAAE;EAC/D;EACA,IAAIA,OAAO,IAAIA,OAAO,CAACC,SAAS,EAAE;IAChCF,eAAe,IAAI,IAAI;EACzB;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAMG,mBAAmB,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE;;EAEzC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAMC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;EAE3B,OAAO,IAAIC,IAAI,CAACC,IAAI,CAACC,KAAK,CAAC,CAACP,eAAe,GAAGG,mBAAmB,IAAI,EAAE,GAAGC,IAAI,CAAC,CAAC;AAClF"}
1
+ {"version":3,"file":"parseDate.js","names":["parseExcelDate","excelSerialDate","options","epoch1904","daysBeforeUnixEpoch","hour","Date","Math","round"],"sources":["../../source/xlsx/parseDate.js"],"sourcesContent":["// Parses an Excel Date (\"serial\") into a corresponding javascript Date in UTC+0 timezone.\r\n// (with time equal to 00:00)\r\n//\r\n// https://www.pcworld.com/article/3063622/software/mastering-excel-date-time-serial-numbers-networkdays-datevalue-and-more.html\r\n// \"If you need to calculate dates in your spreadsheets,\r\n// Excel uses its own unique system, which it calls Serial Numbers\".\r\n//\r\nexport default function parseExcelDate(excelSerialDate, options) {\r\n // https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel\r\n if (options && options.epoch1904) {\r\n excelSerialDate += 1462\r\n }\r\n\r\n // \"Excel serial date\" is just\r\n // the count of days since `01/01/1900`\r\n // (seems that it may be even fractional).\r\n //\r\n // The count of days elapsed\r\n // since `01/01/1900` (Excel epoch)\r\n // till `01/01/1970` (Unix epoch).\r\n // Accounts for leap years\r\n // (19 of them, yielding 19 extra days).\r\n const daysBeforeUnixEpoch = 70 * 365 + 19\r\n\r\n // An hour, approximately, because a minute\r\n // may be longer than 60 seconds, due to \"leap seconds\".\r\n //\r\n // Still, Javascript `Date` (and UNIX time in general) intentionally\r\n // drops the concept of \"leap seconds\" in order to make things simpler.\r\n // So it's fine.\r\n // https://stackoverflow.com/questions/53019726/where-are-the-leap-seconds-in-javascript\r\n //\r\n // \"The JavaScript Date object specifically adheres to the concept of Unix Time\r\n // (albeit with higher precision). This is part of the POSIX specification,\r\n // and thus is sometimes called \"POSIX Time\". It does not count leap seconds,\r\n // but rather assumes every day had exactly 86,400 seconds. You can read about\r\n // this in section 20.3.1.1 of the current ECMAScript specification, which states:\r\n //\r\n // \"Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC.\r\n // In time values leap seconds are ignored. It is assumed that there are exactly\r\n // 86,400,000 milliseconds per day.\"\r\n //\r\n // The fact is, that the unpredictable nature of leap seconds makes them very\r\n // difficult to work with in APIs. One can't generally pass timestamps around\r\n // that need leap seconds tables to be interpreted correctly, and expect that\r\n // one system will interpret them the same as another. For example, while your\r\n // example timestamp 1483228826 is 2017-01-01T00:00:00Z on your system,\r\n // it would be interpreted as 2017-01-01T00:00:26Z on POSIX based systems,\r\n // or systems without leap second tables. So they aren't portable.\r\n // Even on systems that have full updated tables, there's no telling what those\r\n // tables will contain in the future (beyond the 6-month IERS announcement period),\r\n // so I can't produce a future timestamp without risk that it may eventually change.\r\n //\r\n // To be clear - to support leap seconds in a programming language, the implementation\r\n // must go out of its way to do so, and must make tradeoffs that are not always acceptable.\r\n // Though there are exceptions, the general position is to not support them - not because\r\n // of any subversion or active countermeasures, but because supporting them properly is much,\r\n // much harder.\"\r\n //\r\n // https://en.wikipedia.org/wiki/Unix_time#Leap_seconds\r\n // https://en.wikipedia.org/wiki/Leap_year\r\n // https://en.wikipedia.org/wiki/Leap_second\r\n //\r\n const hour = 60 * 60 * 1000\r\n\r\n return new Date(Math.round((excelSerialDate - daysBeforeUnixEpoch) * 24 * hour))\r\n}"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAcA,CAACC,eAAe,EAAEC,OAAO,EAAE;EAC/D;EACA,IAAIA,OAAO,IAAIA,OAAO,CAACC,SAAS,EAAE;IAChCF,eAAe,IAAI,IAAI;EACzB;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAMG,mBAAmB,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE;;EAEzC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAMC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;EAE3B,OAAO,IAAIC,IAAI,CAACC,IAAI,CAACC,KAAK,CAAC,CAACP,eAAe,GAAGG,mBAAmB,IAAI,EAAE,GAAGC,IAAI,CAAC,CAAC;AAClF"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseDate.test.js","names":["_parseDate","_interopRequireDefault","require","obj","__esModule","describe","it","date","convertToUTCTimezone","Date","parseDate","getTime","should","equal","getTimezoneOffset"],"sources":["../../source/read/parseDate.test.js"],"sourcesContent":["import parseDate from './parseDate.js'\r\n\r\ndescribe('parseDate', () => {\r\n\tit('should parse Excel \"serial\" dates', () => {\r\n\t\tconst date = convertToUTCTimezone(new Date(2018, 3 - 1, 24))\r\n // Excel stores dates as integers.\r\n // E.g. '24/03/2018' === 43183\r\n\t\tparseDate(43183).getTime().should.equal(date.getTime())\r\n\t})\r\n})\r\n\r\n// Converts timezone to UTC while preserving the same time\r\nfunction convertToUTCTimezone(date) {\r\n\t// Doesn't account for leap seconds but I guess that's ok\r\n\t// given that javascript's own `Date()` does not either.\r\n\t// https://www.timeanddate.com/time/leap-seconds-background.html\r\n\t//\r\n\t// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset\r\n\t//\r\n\treturn new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1000)\r\n}\r\n"],"mappings":";;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEtCE,QAAQ,CAAC,WAAW,EAAE,YAAM;EAC3BC,EAAE,CAAC,mCAAmC,EAAE,YAAM;IAC7C,IAAMC,IAAI,GAAGC,oBAAoB,CAAC,IAAIC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1D;IACA;IACF,IAAAC,qBAAS,EAAC,KAAK,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,MAAM,CAACC,KAAK,CAACN,IAAI,CAACI,OAAO,CAAC,CAAC,CAAC;EACxD,CAAC,CAAC;AACH,CAAC,CAAC;;AAEF;AACA,SAASH,oBAAoBA,CAACD,IAAI,EAAE;EACnC;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,IAAIE,IAAI,CAACF,IAAI,CAACI,OAAO,CAAC,CAAC,GAAGJ,IAAI,CAACO,iBAAiB,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACvE"}
1
+ {"version":3,"file":"parseDate.test.js","names":["_parseDate","_interopRequireDefault","require","obj","__esModule","describe","it","date","convertToUTCTimezone","Date","parseDate","getTime","should","equal","getTimezoneOffset"],"sources":["../../source/xlsx/parseDate.test.js"],"sourcesContent":["import parseDate from './parseDate.js'\r\n\r\ndescribe('parseDate', () => {\r\n\tit('should parse Excel \"serial\" dates', () => {\r\n\t\tconst date = convertToUTCTimezone(new Date(2018, 3 - 1, 24))\r\n // Excel stores dates as integers.\r\n // E.g. '24/03/2018' === 43183\r\n\t\tparseDate(43183).getTime().should.equal(date.getTime())\r\n\t})\r\n})\r\n\r\n// Converts timezone to UTC while preserving the same time\r\nfunction convertToUTCTimezone(date) {\r\n\t// Doesn't account for leap seconds but I guess that's ok\r\n\t// given that javascript's own `Date()` does not either.\r\n\t// https://www.timeanddate.com/time/leap-seconds-background.html\r\n\t//\r\n\t// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset\r\n\t//\r\n\treturn new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1000)\r\n}\r\n"],"mappings":";;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEtCE,QAAQ,CAAC,WAAW,EAAE,YAAM;EAC3BC,EAAE,CAAC,mCAAmC,EAAE,YAAM;IAC7C,IAAMC,IAAI,GAAGC,oBAAoB,CAAC,IAAIC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1D;IACA;IACF,IAAAC,qBAAS,EAAC,KAAK,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,MAAM,CAACC,KAAK,CAACN,IAAI,CAACI,OAAO,CAAC,CAAC,CAAC;EACxD,CAAC,CAAC;AACH,CAAC,CAAC;;AAEF;AACA,SAASH,oBAAoBA,CAACD,IAAI,EAAE;EACnC;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,IAAIE,IAAI,CAACF,IAAI,CAACI,OAAO,CAAC,CAAC,GAAGJ,IAAI,CAACO,iBAAiB,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseDimensions.js","names":["_coordinates","require","_xlsx","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","len","length","arr2","r","l","t","Symbol","iterator","e","u","a","f","next","done","push","value","isArray","parseDimensions","sheet","dimensions","getDimensions","split","map","parseCellCoordinates","_ref","_ref2","row","column"],"sources":["../../source/read/parseDimensions.js"],"sourcesContent":["import {\r\n parseCellCoordinates\r\n} from './coordinates.js'\r\n\r\nimport {\r\n getDimensions\r\n} from '../xml/xlsx.js'\r\n\r\n// `dimensions` defines the spreadsheet area containing all non-empty cells.\r\n// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1\r\nexport default function parseDimensions(sheet) {\r\n let dimensions = getDimensions(sheet)\r\n if (dimensions) {\r\n dimensions = dimensions.split(':').map(parseCellCoordinates).map(([row, column]) => ({\r\n row,\r\n column\r\n }))\r\n // Sometimes there can be just a single cell as a spreadsheet's \"dimensions\".\r\n // For example, the default \"dimensions\" in Apache POI library is \"A1\",\r\n // meaning that only the first cell in the spreadsheet is used.\r\n //\r\n // A quote from Apache POI library:\r\n // \"Single cell ranges are formatted like single cell references (e.g. 'A1' instead of 'A1:A1').\"\r\n //\r\n if (dimensions.length === 1) {\r\n dimensions = [dimensions[0], dimensions[0]]\r\n }\r\n return dimensions\r\n }\r\n}\r\n\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AAEuB,SAAAE,eAAAC,GAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,GAAA,KAAAG,qBAAA,CAAAH,GAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,GAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAG,CAAA,EAAAC,MAAA,SAAAD,CAAA,qBAAAA,CAAA,sBAAAE,iBAAA,CAAAF,CAAA,EAAAC,MAAA,OAAAE,CAAA,GAAAC,MAAA,CAAAC,SAAA,CAAAC,QAAA,CAAAC,IAAA,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YAAAN,CAAA,eAAAI,CAAA,GAAAJ,CAAA,cAAAf,MAAA,CAAAmB,CAAA,MAAAA,CAAA,2BAAAvB,CAAA,QAAAG,CAAA,aAAAqB,CAAA;AAAA,SAAA7B,gBAAAF,GAAA,QAAAkB,KAAA,CAAAmB,OAAA,CAAArC,GAAA,UAAAA,GAAA;AAEvB;AACA;AACe,SAASsC,eAAeA,CAACC,KAAK,EAAE;EAC7C,IAAIC,UAAU,GAAG,IAAAC,mBAAa,EAACF,KAAK,CAAC;EACrC,IAAIC,UAAU,EAAE;IACdA,UAAU,GAAGA,UAAU,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,iCAAoB,CAAC,CAACD,GAAG,CAAC,UAAAE,IAAA;MAAA,IAAAC,KAAA,GAAA/C,cAAA,CAAA8C,IAAA;QAAEE,GAAG,GAAAD,KAAA;QAAEE,MAAM,GAAAF,KAAA;MAAA,OAAO;QACnFC,GAAG,EAAHA,GAAG;QACHC,MAAM,EAANA;MACF,CAAC;IAAA,CAAC,CAAC;IACH;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAIR,UAAU,CAAClB,MAAM,KAAK,CAAC,EAAE;MAC3BkB,UAAU,GAAG,CAACA,UAAU,CAAC,CAAC,CAAC,EAAEA,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7C;IACA,OAAOA,UAAU;EACnB;AACF"}
1
+ {"version":3,"file":"parseDimensions.js","names":["_coordinates","require","_xlsx","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","len","length","arr2","r","l","t","Symbol","iterator","e","u","a","f","next","done","push","value","isArray","parseDimensions","sheet","dimensions","getDimensions","split","map","parseCellCoordinates","_ref","_ref2","row","column"],"sources":["../../source/xlsx/parseDimensions.js"],"sourcesContent":["import {\r\n parseCellCoordinates\r\n} from './coordinates.js'\r\n\r\nimport {\r\n getDimensions\r\n} from '../xml/xlsx.js'\r\n\r\n// `dimensions` defines the spreadsheet area containing all non-empty cells.\r\n// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1\r\nexport default function parseDimensions(sheet) {\r\n let dimensions = getDimensions(sheet)\r\n if (dimensions) {\r\n dimensions = dimensions.split(':').map(parseCellCoordinates).map(([row, column]) => ({\r\n row,\r\n column\r\n }))\r\n // Sometimes there can be just a single cell as a spreadsheet's \"dimensions\".\r\n // For example, the default \"dimensions\" in Apache POI library is \"A1\",\r\n // meaning that only the first cell in the spreadsheet is used.\r\n //\r\n // A quote from Apache POI library:\r\n // \"Single cell ranges are formatted like single cell references (e.g. 'A1' instead of 'A1:A1').\"\r\n //\r\n if (dimensions.length === 1) {\r\n dimensions = [dimensions[0], dimensions[0]]\r\n }\r\n return dimensions\r\n }\r\n}\r\n\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AAEuB,SAAAE,eAAAC,GAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,GAAA,KAAAG,qBAAA,CAAAH,GAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,GAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAG,CAAA,EAAAC,MAAA,SAAAD,CAAA,qBAAAA,CAAA,sBAAAE,iBAAA,CAAAF,CAAA,EAAAC,MAAA,OAAAE,CAAA,GAAAC,MAAA,CAAAC,SAAA,CAAAC,QAAA,CAAAC,IAAA,CAAAP,CAAA,EAAAQ,KAAA,aAAAL,CAAA,iBAAAH,CAAA,CAAAS,WAAA,EAAAN,CAAA,GAAAH,CAAA,CAAAS,WAAA,CAAAC,IAAA,MAAAP,CAAA,cAAAA,CAAA,mBAAAQ,KAAA,CAAAC,IAAA,CAAAZ,CAAA,OAAAG,CAA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,GAAA;AAEvB;AACA;AACe,SAASsC,eAAeA,CAACC,KAAK,EAAE;EAC7C,IAAIC,UAAU,GAAG,IAAAC,mBAAa,EAACF,KAAK,CAAC;EACrC,IAAIC,UAAU,EAAE;IACdA,UAAU,GAAGA,UAAU,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,iCAAoB,CAAC,CAACD,GAAG,CAAC,UAAAE,IAAA;MAAA,IAAAC,KAAA,GAAA/C,cAAA,CAAA8C,IAAA;QAAEE,GAAG,GAAAD,KAAA;QAAEE,MAAM,GAAAF,KAAA;MAAA,OAAO;QACnFC,GAAG,EAAHA,GAAG;QACHC,MAAM,EAANA;MACF,CAAC;IAAA,CAAC,CAAC;IACH;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAIR,UAAU,CAAClB,MAAM,KAAK,CAAC,EAAE;MAC3BkB,UAAU,GAAG,CAACA,UAAU,CAAC,CAAC,CAAC,EAAEA,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7C;IACA,OAAOA,UAAU;EACnB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseFilePaths.js","names":["_xlsx","require","parseFilePaths","content","xml","document","createDocument","filePaths","sheets","sharedStrings","undefined","styles","addFilePathInfo","relationship","filePath","getAttribute","fileType","getFilePath","getRelationships","forEach","path","slice","length"],"sources":["../../source/read/parseFilePaths.js"],"sourcesContent":["import {\r\n getRelationships\r\n} from '../xml/xlsx.js'\r\n\r\n/**\r\n * Returns sheet file paths.\r\n * Seems that the correct place to look for the `sheetId` -> `filename` mapping\r\n * is `xl/_rels/workbook.xml.rels` file.\r\n * https://github.com/tidyverse/readxl/issues/104\r\n * @param {string} content — `xl/_rels/workbook.xml.rels` file contents.\r\n * @param {object} xml\r\n * @return {object}\r\n */\r\nexport default function parseFilePaths(content, xml) {\r\n // Example:\r\n // <Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\r\n // ...\r\n // <Relationship\r\n // Id=\"rId3\"\r\n // Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\"\r\n // Target=\"worksheets/sheet1.xml\"/>\r\n // </Relationships>\r\n const document = xml.createDocument(content)\r\n\r\n const filePaths = {\r\n sheets: {},\r\n sharedStrings: undefined,\r\n styles: undefined\r\n }\r\n\r\n const addFilePathInfo = (relationship) => {\r\n const filePath = relationship.getAttribute('Target')\r\n const fileType = relationship.getAttribute('Type')\r\n switch (fileType) {\r\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles':\r\n filePaths.styles = getFilePath(filePath)\r\n break\r\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings':\r\n filePaths.sharedStrings = getFilePath(filePath)\r\n break\r\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet':\r\n filePaths.sheets[relationship.getAttribute('Id')] = getFilePath(filePath)\r\n break\r\n }\r\n }\r\n\r\n getRelationships(document).forEach(addFilePathInfo)\r\n\r\n // Seems like \"sharedStrings.xml\" is not required to exist.\r\n // For example, when the spreadsheet doesn't contain any strings.\r\n // https://github.com/catamphetamine/read-excel-file/issues/85\r\n // if (!filePaths.sharedStrings) {\r\n // throw new Error('\"sharedStrings.xml\" file not found in the *.xlsx file')\r\n // }\r\n\r\n return filePaths\r\n}\r\n\r\nfunction getFilePath(path) {\r\n // Normally, `path` is a relative path inside the ZIP archive,\r\n // like \"worksheets/sheet1.xml\", or \"sharedStrings.xml\", or \"styles.xml\".\r\n // There has been one weird case when file path was an absolute path,\r\n // like \"/xl/worksheets/sheet1.xml\" (specifically for sheets):\r\n // https://github.com/catamphetamine/read-excel-file/pull/95\r\n // Other libraries (like `xlsx`) and software (like Google Docs)\r\n // seem to support such absolute file paths, so this library does too.\r\n if (path[0] === '/') {\r\n return path.slice('/'.length)\r\n }\r\n // // Seems like a path could also be a URL.\r\n // // http://officeopenxml.com/anatomyofOOXML-xlsx.php\r\n // if (/^[a-z]+\\:\\/\\//.test(path)) {\r\n // return path\r\n // }\r\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;EACA;EACA;EACA;EACA,OAAO,KAAK,GAAGF,IAAI;AACrB"}
1
+ {"version":3,"file":"parseFilePaths.js","names":["_xlsx","require","parseFilePaths","content","xml","document","createDocument","filePaths","sheets","sharedStrings","undefined","styles","addFilePathInfo","relationship","filePath","getAttribute","fileType","getFilePath","getRelationships","forEach","path","slice","length"],"sources":["../../source/xlsx/parseFilePaths.js"],"sourcesContent":["import {\r\n getRelationships\r\n} from '../xml/xlsx.js'\r\n\r\n/**\r\n * Returns sheet file paths.\r\n * Seems that the correct place to look for the `sheetId` -> `filename` mapping\r\n * is `xl/_rels/workbook.xml.rels` file.\r\n * https://github.com/tidyverse/readxl/issues/104\r\n * @param {string} content — `xl/_rels/workbook.xml.rels` file contents.\r\n * @param {object} xml\r\n * @return {object}\r\n */\r\nexport default function parseFilePaths(content, xml) {\r\n // Example:\r\n // <Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\r\n // ...\r\n // <Relationship\r\n // Id=\"rId3\"\r\n // Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\"\r\n // Target=\"worksheets/sheet1.xml\"/>\r\n // </Relationships>\r\n const document = xml.createDocument(content)\r\n\r\n const filePaths = {\r\n sheets: {},\r\n sharedStrings: undefined,\r\n styles: undefined\r\n }\r\n\r\n const addFilePathInfo = (relationship) => {\r\n const filePath = relationship.getAttribute('Target')\r\n const fileType = relationship.getAttribute('Type')\r\n switch (fileType) {\r\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles':\r\n filePaths.styles = getFilePath(filePath)\r\n break\r\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings':\r\n filePaths.sharedStrings = getFilePath(filePath)\r\n break\r\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet':\r\n filePaths.sheets[relationship.getAttribute('Id')] = getFilePath(filePath)\r\n break\r\n }\r\n }\r\n\r\n getRelationships(document).forEach(addFilePathInfo)\r\n\r\n // Seems like \"sharedStrings.xml\" is not required to exist.\r\n // For example, when the spreadsheet doesn't contain any strings.\r\n // https://github.com/catamphetamine/read-excel-file/issues/85\r\n // if (!filePaths.sharedStrings) {\r\n // throw new Error('\"sharedStrings.xml\" file not found in the *.xlsx file')\r\n // }\r\n\r\n return filePaths\r\n}\r\n\r\nfunction getFilePath(path) {\r\n // Normally, `path` is a relative path inside the ZIP archive,\r\n // like \"worksheets/sheet1.xml\", or \"sharedStrings.xml\", or \"styles.xml\".\r\n // There has been one weird case when file path was an absolute path,\r\n // like \"/xl/worksheets/sheet1.xml\" (specifically for sheets):\r\n // https://github.com/catamphetamine/read-excel-file/pull/95\r\n // Other libraries (like `xlsx`) and software (like Google Docs)\r\n // seem to support such absolute file paths, so this library does too.\r\n if (path[0] === '/') {\r\n return path.slice('/'.length)\r\n }\r\n // // Seems like a path could also be a URL.\r\n // // http://officeopenxml.com/anatomyofOOXML-xlsx.php\r\n // if (/^[a-z]+\\:\\/\\//.test(path)) {\r\n // return path\r\n // }\r\n return 'xl/' + path\r\n}"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAACC,OAAO,EAAEC,GAAG,EAAE;EACnD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAMC,QAAQ,GAAGD,GAAG,CAACE,cAAc,CAACH,OAAO,CAAC;EAE5C,IAAMI,SAAS,GAAG;IAChBC,MAAM,EAAE,CAAC,CAAC;IACVC,aAAa,EAAEC,SAAS;IACxBC,MAAM,EAAED;EACV,CAAC;EAED,IAAME,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,YAAY,EAAK;IACxC,IAAMC,QAAQ,GAAGD,YAAY,CAACE,YAAY,CAAC,QAAQ,CAAC;IACpD,IAAMC,QAAQ,GAAGH,YAAY,CAACE,YAAY,CAAC,MAAM,CAAC;IAClD,QAAQC,QAAQ;MACd,KAAK,4EAA4E;QAC/ET,SAAS,CAACI,MAAM,GAAGM,WAAW,CAACH,QAAQ,CAAC;QACxC;MACF,KAAK,mFAAmF;QACtFP,SAAS,CAACE,aAAa,GAAGQ,WAAW,CAACH,QAAQ,CAAC;QAC/C;MACF,KAAK,+EAA+E;QAClFP,SAAS,CAACC,MAAM,CAACK,YAAY,CAACE,YAAY,CAAC,IAAI,CAAC,CAAC,GAAGE,WAAW,CAACH,QAAQ,CAAC;QACzE;IACJ;EACF,CAAC;EAED,IAAAI,sBAAgB,EAACb,QAAQ,CAAC,CAACc,OAAO,CAACP,eAAe,CAAC;;EAEnD;EACA;EACA;EACA;EACA;EACA;;EAEA,OAAOL,SAAS;AAClB;AAEA,SAASU,WAAWA,CAACG,IAAI,EAAE;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAIA,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;IACnB,OAAOA,IAAI,CAACC,KAAK,CAAC,GAAG,CAACC,MAAM,CAAC;EAC/B;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,KAAK,GAAGF,IAAI;AACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseProperties.js","names":["_xlsx","require","parseProperties","content","xml","book","createDocument","properties","workbookProperties","getWorkbookProperties","getAttribute","epoch1904","sheets","addSheetInfo","sheet","push","id","name","relationId","getSheets","forEach"],"sources":["../../source/read/parseProperties.js"],"sourcesContent":["import {\r\n getWorkbookProperties,\r\n getSheets\r\n} from '../xml/xlsx.js'\r\n\r\n// I guess `xl/workbook.xml` file should always be present inside the *.xlsx archive.\r\nexport default function parseProperties(content, xml) {\r\n const book = xml.createDocument(content)\r\n\r\n const properties = {};\r\n\r\n // Read `<workbookPr/>` element to detect whether dates are 1900-based or 1904-based.\r\n // https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel\r\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/workbookPr.html\r\n\r\n const workbookProperties = getWorkbookProperties(book)\r\n\r\n if (workbookProperties && workbookProperties.getAttribute('date1904') === '1') {\r\n properties.epoch1904 = true\r\n }\r\n\r\n // Get sheets info (indexes, names, if they're available).\r\n // Example:\r\n // <sheets>\r\n // <sheet\r\n // xmlns:ns=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"\r\n // name=\"Sheet1\"\r\n // sheetId=\"1\"\r\n // ns:id=\"rId3\"/>\r\n // </sheets>\r\n // http://www.datypic.com/sc/ooxml/e-ssml_sheet-1.html\r\n\r\n properties.sheets = []\r\n\r\n const addSheetInfo = (sheet) => {\r\n if (sheet.getAttribute('name')) {\r\n properties.sheets.push({\r\n id: sheet.getAttribute('sheetId'),\r\n name: sheet.getAttribute('name'),\r\n relationId: sheet.getAttribute('r:id')\r\n })\r\n }\r\n }\r\n\r\n getSheets(book).forEach(addSheetInfo)\r\n\r\n return properties;\r\n}"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA;AACe,SAASC,eAAeA,CAACC,OAAO,EAAEC,GAAG,EAAE;EACpD,IAAMC,IAAI,GAAGD,GAAG,CAACE,cAAc,CAACH,OAAO,CAAC;EAExC,IAAMI,UAAU,GAAG,CAAC,CAAC;;EAErB;EACA;EACA;;EAEA,IAAMC,kBAAkB,GAAG,IAAAC,2BAAqB,EAACJ,IAAI,CAAC;EAEtD,IAAIG,kBAAkB,IAAIA,kBAAkB,CAACE,YAAY,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE;IAC7EH,UAAU,CAACI,SAAS,GAAG,IAAI;EAC7B;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEAJ,UAAU,CAACK,MAAM,GAAG,EAAE;EAEtB,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIC,KAAK,EAAK;IAC9B,IAAIA,KAAK,CAACJ,YAAY,CAAC,MAAM,CAAC,EAAE;MAC9BH,UAAU,CAACK,MAAM,CAACG,IAAI,CAAC;QACrBC,EAAE,EAAEF,KAAK,CAACJ,YAAY,CAAC,SAAS,CAAC;QACjCO,IAAI,EAAEH,KAAK,CAACJ,YAAY,CAAC,MAAM,CAAC;QAChCQ,UAAU,EAAEJ,KAAK,CAACJ,YAAY,CAAC,MAAM;MACvC,CAAC,CAAC;IACJ;EACF,CAAC;EAED,IAAAS,eAAS,EAACd,IAAI,CAAC,CAACe,OAAO,CAACP,YAAY,CAAC;EAErC,OAAON,UAAU;AACnB"}
1
+ {"version":3,"file":"parseProperties.js","names":["_xlsx","require","parseProperties","content","xml","book","createDocument","properties","workbookProperties","getWorkbookProperties","getAttribute","epoch1904","sheets","addSheetInfo","sheet","push","id","name","relationId","getSheets","forEach"],"sources":["../../source/xlsx/parseProperties.js"],"sourcesContent":["import {\r\n getWorkbookProperties,\r\n getSheets\r\n} from '../xml/xlsx.js'\r\n\r\n// I guess `xl/workbook.xml` file should always be present inside the *.xlsx archive.\r\nexport default function parseProperties(content, xml) {\r\n const book = xml.createDocument(content)\r\n\r\n const properties = {};\r\n\r\n // Read `<workbookPr/>` element to detect whether dates are 1900-based or 1904-based.\r\n // https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel\r\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/workbookPr.html\r\n\r\n const workbookProperties = getWorkbookProperties(book)\r\n\r\n if (workbookProperties && workbookProperties.getAttribute('date1904') === '1') {\r\n properties.epoch1904 = true\r\n }\r\n\r\n // Get sheets info (indexes, names, if they're available).\r\n // Example:\r\n // <sheets>\r\n // <sheet\r\n // xmlns:ns=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"\r\n // name=\"Sheet1\"\r\n // sheetId=\"1\"\r\n // ns:id=\"rId3\"/>\r\n // </sheets>\r\n // http://www.datypic.com/sc/ooxml/e-ssml_sheet-1.html\r\n\r\n properties.sheets = []\r\n\r\n const addSheetInfo = (sheet) => {\r\n if (sheet.getAttribute('name')) {\r\n properties.sheets.push({\r\n id: sheet.getAttribute('sheetId'),\r\n name: sheet.getAttribute('name'),\r\n relationId: sheet.getAttribute('r:id')\r\n })\r\n }\r\n }\r\n\r\n getSheets(book).forEach(addSheetInfo)\r\n\r\n return properties;\r\n}"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA;AACe,SAASC,eAAeA,CAACC,OAAO,EAAEC,GAAG,EAAE;EACpD,IAAMC,IAAI,GAAGD,GAAG,CAACE,cAAc,CAACH,OAAO,CAAC;EAExC,IAAMI,UAAU,GAAG,CAAC,CAAC;;EAErB;EACA;EACA;;EAEA,IAAMC,kBAAkB,GAAG,IAAAC,2BAAqB,EAACJ,IAAI,CAAC;EAEtD,IAAIG,kBAAkB,IAAIA,kBAAkB,CAACE,YAAY,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE;IAC7EH,UAAU,CAACI,SAAS,GAAG,IAAI;EAC7B;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEAJ,UAAU,CAACK,MAAM,GAAG,EAAE;EAEtB,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIC,KAAK,EAAK;IAC9B,IAAIA,KAAK,CAACJ,YAAY,CAAC,MAAM,CAAC,EAAE;MAC9BH,UAAU,CAACK,MAAM,CAACG,IAAI,CAAC;QACrBC,EAAE,EAAEF,KAAK,CAACJ,YAAY,CAAC,SAAS,CAAC;QACjCO,IAAI,EAAEH,KAAK,CAACJ,YAAY,CAAC,MAAM,CAAC;QAChCQ,UAAU,EAAEJ,KAAK,CAACJ,YAAY,CAAC,MAAM;MACvC,CAAC,CAAC;IACJ;EACF,CAAC;EAED,IAAAS,eAAS,EAACd,IAAI,CAAC,CAACe,OAAO,CAACP,YAAY,CAAC;EAErC,OAAON,UAAU;AACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseSharedStrings.js","names":["_xlsx","require","parseSharedStrings","content","xml","getSharedStrings","createDocument"],"sources":["../../source/read/parseSharedStrings.js"],"sourcesContent":["import {\r\n getSharedStrings\r\n} from '../xml/xlsx.js'\r\n\r\nexport default function parseSharedStrings(content, xml) {\r\n if (!content) {\r\n return []\r\n }\r\n return getSharedStrings(xml.createDocument(content))\r\n}"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIe,SAASC,kBAAkBA,CAACC,OAAO,EAAEC,GAAG,EAAE;EACvD,IAAI,CAACD,OAAO,EAAE;IACZ,OAAO,EAAE;EACX;EACA,OAAO,IAAAE,sBAAgB,EAACD,GAAG,CAACE,cAAc,CAACH,OAAO,CAAC,CAAC;AACtD"}
1
+ {"version":3,"file":"parseSharedStrings.js","names":["_xlsx","require","parseSharedStrings","content","xml","getSharedStrings","createDocument"],"sources":["../../source/xlsx/parseSharedStrings.js"],"sourcesContent":["import {\r\n getSharedStrings\r\n} from '../xml/xlsx.js'\r\n\r\nexport default function parseSharedStrings(content, xml) {\r\n if (!content) {\r\n return []\r\n }\r\n return getSharedStrings(xml.createDocument(content))\r\n}"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIe,SAASC,kBAAkBA,CAACC,OAAO,EAAEC,GAAG,EAAE;EACvD,IAAI,CAACD,OAAO,EAAE;IACZ,OAAO,EAAE;EACX;EACA,OAAO,IAAAE,sBAAgB,EAACD,GAAG,CAACE,cAAc,CAACH,OAAO,CAAC,CAAC;AACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseSheet.js","names":["_parseCells","_interopRequireDefault","require","_parseDimensions","_coordinates","obj","__esModule","parseSheet","content","xml","values","styles","properties","options","sheet","createDocument","cells","parseCells","dimensions","parseDimensions","calculateDimensions"],"sources":["../../source/read/parseSheet.js"],"sourcesContent":["import parseCells from './parseCells.js'\r\nimport parseDimensions from './parseDimensions.js'\r\n\r\nimport { calculateDimensions } from './coordinates.js'\r\n\r\nexport default function parseSheet(content, xml, values, styles, properties, options) {\r\n const sheet = xml.createDocument(content)\r\n\r\n const cells = parseCells(sheet, xml, values, styles, properties, options)\r\n\r\n // `dimensions` defines the spreadsheet area containing all non-empty cells.\r\n // https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1\r\n const dimensions = parseDimensions(sheet) || calculateDimensions(cells)\r\n\r\n return { cells, dimensions }\r\n}"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAAsD,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEvC,SAASE,UAAUA,CAACC,OAAO,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE;EACpF,IAAMC,KAAK,GAAGL,GAAG,CAACM,cAAc,CAACP,OAAO,CAAC;EAEzC,IAAMQ,KAAK,GAAG,IAAAC,sBAAU,EAACH,KAAK,EAAEL,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,CAAC;;EAEzE;EACA;EACA,IAAMK,UAAU,GAAG,IAAAC,2BAAe,EAACL,KAAK,CAAC,IAAI,IAAAM,gCAAmB,EAACJ,KAAK,CAAC;EAEvE,OAAO;IAAEA,KAAK,EAALA,KAAK;IAAEE,UAAU,EAAVA;EAAW,CAAC;AAC9B"}
1
+ {"version":3,"file":"parseSheet.js","names":["_parseCells","_interopRequireDefault","require","_parseDimensions","_coordinates","obj","__esModule","parseSheet","content","xml","values","styles","properties","options","sheet","createDocument","cells","parseCells","dimensions","parseDimensions","calculateDimensions"],"sources":["../../source/xlsx/parseSheet.js"],"sourcesContent":["import parseCells from './parseCells.js'\r\nimport parseDimensions from './parseDimensions.js'\r\n\r\nimport { calculateDimensions } from './coordinates.js'\r\n\r\nexport default function parseSheet(content, xml, values, styles, properties, options) {\r\n const sheet = xml.createDocument(content)\r\n\r\n const cells = parseCells(sheet, xml, values, styles, properties, options)\r\n\r\n // `dimensions` defines the spreadsheet area containing all non-empty cells.\r\n // https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1\r\n const dimensions = parseDimensions(sheet) || calculateDimensions(cells)\r\n\r\n return { cells, dimensions }\r\n}"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAAsD,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEvC,SAASE,UAAUA,CAACC,OAAO,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE;EACpF,IAAMC,KAAK,GAAGL,GAAG,CAACM,cAAc,CAACP,OAAO,CAAC;EAEzC,IAAMQ,KAAK,GAAG,IAAAC,sBAAU,EAACH,KAAK,EAAEL,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,CAAC;;EAEzE;EACA;EACA,IAAMK,UAAU,GAAG,IAAAC,2BAAe,EAACL,KAAK,CAAC,IAAI,IAAAM,gCAAmB,EAACJ,KAAK,CAAC;EAEvE,OAAO;IAAEA,KAAK,EAALA,KAAK;IAAEE,UAAU,EAAVA;EAAW,CAAC;AAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseStyles.js","names":["_xlsx","require","_typeof","o","Symbol","iterator","constructor","prototype","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","key","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","TypeError","Number","parseStyles","content","xml","doc","createDocument","baseStyles","getBaseStyles","map","parseCellStyle","numberFormats","getNumberFormats","parseNumberFormatStyle","reduce","formats","format","id","getCellStyle","xf","hasAttribute","xfId","getCellStyles","numFmt","getAttribute","template","numFmts","style","numberFormatId","numberFormat"],"sources":["../../source/read/parseStyles.js"],"sourcesContent":["import {\r\n getBaseStyles,\r\n getCellStyles,\r\n getNumberFormats\r\n} from '../xml/xlsx.js'\r\n\r\n// http://officeopenxml.com/SSstyles.php\r\n// Returns an array of cell styles.\r\n// A cell style index is its ID.\r\nexport default function parseStyles(content, xml) {\r\n if (!content) {\r\n return {}\r\n }\r\n\r\n // https://social.msdn.microsoft.com/Forums/sqlserver/en-US/708978af-b598-45c4-a598-d3518a5a09f0/howwhen-is-cellstylexfs-vs-cellxfs-applied-to-a-cell?forum=os_binaryfile\r\n // https://www.office-forums.com/threads/cellxfs-cellstylexfs.2163519/\r\n const doc = xml.createDocument(content)\r\n\r\n const baseStyles = getBaseStyles(doc)\r\n .map(parseCellStyle)\r\n\r\n const numberFormats = getNumberFormats(doc)\r\n .map(parseNumberFormatStyle)\r\n .reduce((formats, format) => {\r\n // Format ID is a numeric index.\r\n // There're some standard \"built-in\" formats (in Excel) up to about `100`.\r\n formats[format.id] = format\r\n return formats\r\n }, [])\r\n\r\n const getCellStyle = (xf) => {\r\n if (xf.hasAttribute('xfId')) {\r\n return {\r\n ...baseStyles[xf.xfId],\r\n ...parseCellStyle(xf, numberFormats)\r\n }\r\n }\r\n return parseCellStyle(xf, numberFormats)\r\n }\r\n\r\n return getCellStyles(doc).map(getCellStyle)\r\n}\r\n\r\nfunction parseNumberFormatStyle(numFmt) {\r\n return {\r\n id: numFmt.getAttribute('numFmtId'),\r\n template: numFmt.getAttribute('formatCode')\r\n }\r\n}\r\n\r\n// http://www.datypic.com/sc/ooxml/e-ssml_xf-2.html\r\nfunction parseCellStyle(xf, numFmts) {\r\n const style = {}\r\n if (xf.hasAttribute('numFmtId')) {\r\n const numberFormatId = xf.getAttribute('numFmtId')\r\n // Built-in number formats don't have a `<numFmt/>` element in `styles.xml`.\r\n // https://hexdocs.pm/xlsxir/number_styles.html\r\n if (numFmts[numberFormatId]) {\r\n style.numberFormat = numFmts[numberFormatId]\r\n } else {\r\n style.numberFormat = { id: numberFormatId }\r\n }\r\n }\r\n return style\r\n}"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIuB,SAAAC,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAAA,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAX,CAAA,GAAAS,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAP,CAAA,GAAAA,CAAA,CAAAY,MAAA,WAAAL,CAAA,WAAAE,MAAA,CAAAI,wBAAA,CAAAP,CAAA,EAAAC,CAAA,EAAAO,UAAA,OAAAN,CAAA,CAAAO,IAAA,CAAAC,KAAA,CAAAR,CAAA,EAAAR,CAAA,YAAAQ,CAAA;AAAA,SAAAS,cAAAX,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAW,SAAA,CAAAC,MAAA,EAAAZ,CAAA,UAAAC,CAAA,WAAAU,SAAA,CAAAX,CAAA,IAAAW,SAAA,CAAAX,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAY,OAAA,WAAAb,CAAA,IAAAc,eAAA,CAAAf,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA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KAAK,CAACE,YAAY,GAAGH,OAAO,CAACE,cAAc,CAAC;IAC9C,CAAC,MAAM;MACLD,KAAK,CAACE,YAAY,GAAG;QAAEZ,EAAE,EAAEW;MAAe,CAAC;IAC7C;EACF;EACA,OAAOD,KAAK;AACd"}
1
+ {"version":3,"file":"parseStyles.js","names":["_xlsx","require","_typeof","o","Symbol","iterator","constructor","prototype","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","key","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","TypeError","Number","parseStyles","content","xml","doc","createDocument","baseStyles","getBaseStyles","map","parseCellStyle","numberFormats","getNumberFormats","parseNumberFormatStyle","reduce","formats","format","id","getCellStyle","xf","hasAttribute","xfId","getCellStyles","numFmt","getAttribute","template","numFmts","style","numberFormatId","numberFormat"],"sources":["../../source/xlsx/parseStyles.js"],"sourcesContent":["import {\r\n getBaseStyles,\r\n getCellStyles,\r\n getNumberFormats\r\n} from '../xml/xlsx.js'\r\n\r\n// http://officeopenxml.com/SSstyles.php\r\n// Returns an array of cell styles.\r\n// A cell style index is its ID.\r\nexport default function parseStyles(content, xml) {\r\n if (!content) {\r\n return {}\r\n }\r\n\r\n // https://social.msdn.microsoft.com/Forums/sqlserver/en-US/708978af-b598-45c4-a598-d3518a5a09f0/howwhen-is-cellstylexfs-vs-cellxfs-applied-to-a-cell?forum=os_binaryfile\r\n // https://www.office-forums.com/threads/cellxfs-cellstylexfs.2163519/\r\n const doc = xml.createDocument(content)\r\n\r\n const baseStyles = getBaseStyles(doc)\r\n .map(parseCellStyle)\r\n\r\n const numberFormats = getNumberFormats(doc)\r\n .map(parseNumberFormatStyle)\r\n .reduce((formats, format) => {\r\n // Format ID is a numeric index.\r\n // There're some standard \"built-in\" formats (in Excel) up to about `100`.\r\n formats[format.id] = format\r\n return formats\r\n }, [])\r\n\r\n const getCellStyle = (xf) => {\r\n if (xf.hasAttribute('xfId')) {\r\n return {\r\n ...baseStyles[xf.xfId],\r\n ...parseCellStyle(xf, numberFormats)\r\n }\r\n }\r\n return parseCellStyle(xf, numberFormats)\r\n }\r\n\r\n return getCellStyles(doc).map(getCellStyle)\r\n}\r\n\r\nfunction parseNumberFormatStyle(numFmt) {\r\n return {\r\n id: numFmt.getAttribute('numFmtId'),\r\n template: numFmt.getAttribute('formatCode')\r\n }\r\n}\r\n\r\n// http://www.datypic.com/sc/ooxml/e-ssml_xf-2.html\r\nfunction parseCellStyle(xf, numFmts) {\r\n const style = {}\r\n if (xf.hasAttribute('numFmtId')) {\r\n const numberFormatId = xf.getAttribute('numFmtId')\r\n // Built-in number formats don't have a `<numFmt/>` element in `styles.xml`.\r\n // https://hexdocs.pm/xlsxir/number_styles.html\r\n if (numFmts[numberFormatId]) {\r\n style.numberFormat = numFmts[numberFormatId]\r\n } else {\r\n style.numberFormat = { id: numberFormatId }\r\n }\r\n }\r\n return style\r\n}"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIuB,SAAAC,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAAA,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAX,CAAA,GAAAS,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAP,CAAA,GAAAA,CAAA,CAAAY,MAAA,WAAAL,CAAA,WAAAE,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AC7C;AAEA,SAASL,sBAAsBA,CAACU,MAAM,EAAE;EACtC,OAAO;IACLN,EAAE,EAAEM,MAAM,CAACC,YAAY,CAAC,UAAU,CAAC;IACnCC,QAAQ,EAAEF,MAAM,CAACC,YAAY,CAAC,YAAY;EAC5C,CAAC;AACH;;AAEA;AACA,SAASd,cAAcA,CAACS,EAAE,EAAEO,OAAO,EAAE;EACnC,IAAMC,KAAK,GAAG,CAAC,CAAC;EAChB,IAAIR,EAAE,CAACC,YAAY,CAAC,UAAU,CAAC,EAAE;IAC/B,IAAMQ,cAAc,GAAGT,EAAE,CAACK,YAAY,CAAC,UAAU,CAAC;IAClD;IACA;IACA,IAAIE,OAAO,CAACE,cAAc,CAAC,EAAE;MAC3BD,KAAK,CAACE,YAAY,GAAGH,OAAO,CAACE,cAAc,CAAC;IAC9C,CAAC,MAAM;MACLD,KAAK,CAACE,YAAY,GAAG;QAAEZ,EAAE,EAAEW;MAAe,CAAC;IAC7C;EACF;EACA,OAAOD,KAAK;AACd"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = readXlsx;
6
+ exports["default"] = parseXlsxFileContents;
7
7
  var _parseProperties = _interopRequireDefault(require("./parseProperties.js"));
8
8
  var _parseFilePaths = _interopRequireDefault(require("./parseFilePaths.js"));
9
9
  var _parseStyles = _interopRequireDefault(require("./parseStyles.js"));
@@ -23,14 +23,14 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
23
23
  // For an introduction in reading `*.xlsx` files see "The minimum viable XLSX reader":
24
24
  // https://www.brendanlong.com/the-minimum-viable-xlsx-reader.html
25
25
  /**
26
- * Reads an (unzipped) XLSX file structure into a 2D array of cells.
27
- * @param {object} contents - A list of XML files inside XLSX file (which is a zipped directory).
26
+ * Reads data from an `.xlsx` spreadsheet.
27
+ * @param {Record<string,string>} contents - A map of XML files inside XLSX file (which is just a zipped directory).
28
+ * @param {object} xml — An object with a function `createDocument(string)`.
28
29
  * @param {number?} options.sheet - Workbook sheet id (`1` by default).
29
30
  * @param {string?} options.dateFormat - Date format, e.g. "mm/dd/yyyy". Values having this format template set will be parsed as dates.
30
- * @param {object} contents - A list of XML files inside XLSX file (which is a zipped directory).
31
31
  * @return {object} An object of shape `{ data, cells, properties }`. `data: string[][]` is an array of rows, each row being an array of cell values. `cells: string[][]` is an array of rows, each row being an array of cells. `properties: object` is the spreadsheet properties (e.g. whether date epoch is 1904 instead of 1900).
32
32
  */
33
- function readXlsx(contents, xml) {
33
+ function parseXlsxFileContents(contents, xml) {
34
34
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
35
35
  if (!options.sheet) {
36
36
  options = _objectSpread({
@@ -44,14 +44,15 @@ function readXlsx(contents, xml) {
44
44
  return contents[filePath];
45
45
  };
46
46
 
47
- // Some Excel editors don't want to use standard naming scheme for sheet files.
47
+ // Read the paths to certain files inside the `.xlsx` `.zip` archive.
48
+ // These paths aren't standardized between different spreadsheet editors.
48
49
  // https://github.com/tidyverse/readxl/issues/104
49
50
  var filePaths = (0, _parseFilePaths["default"])(getXmlFileContent('xl/_rels/workbook.xml.rels'), xml);
50
51
 
51
- // Default file path for "shared strings": "xl/sharedStrings.xml".
52
+ // Usual file path for "shared strings": "xl/sharedStrings.xml".
52
53
  var values = filePaths.sharedStrings ? (0, _parseSharedStrings["default"])(getXmlFileContent(filePaths.sharedStrings), xml) : [];
53
54
 
54
- // Default file path for "styles": "xl/styles.xml".
55
+ // Usual file path for "styles": "xl/styles.xml".
55
56
  var styles = filePaths.styles ? (0, _parseStyles["default"])(getXmlFileContent(filePaths.styles), xml) : {};
56
57
  var properties = (0, _parseProperties["default"])(getXmlFileContent('xl/workbook.xml'), xml);
57
58
 
@@ -115,4 +116,4 @@ function createSheetNotFoundError(sheet, sheets) {
115
116
  }).join(', ');
116
117
  return new Error("Sheet ".concat(typeof sheet === 'number' ? '#' + sheet : '"' + sheet + '"', " not found in the *.xlsx file.").concat(sheets ? ' Available sheets: ' + sheetsList + '.' : ''));
117
118
  }
118
- //# sourceMappingURL=readXlsx.js.map
119
+ //# sourceMappingURL=parseXlsxFileContents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseXlsxFileContents.js","names":["_parseProperties","_interopRequireDefault","require","_parseFilePaths","_parseStyles","_parseSharedStrings","_parseSheet","_getData","obj","__esModule","_typeof","o","Symbol","iterator","constructor","prototype","_createForOfIteratorHelperLoose","allowArrayLike","it","call","next","bind","Array","isArray","_unsupportedIterableToArray","length","i","done","value","TypeError","minLen","_arrayLikeToArray","n","Object","toString","slice","name","from","test","arr","len","arr2","ownKeys","e","r","t","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","Number","parseXlsxFileContents","contents","xml","options","sheet","getXmlFileContent","filePath","Error","concat","filePaths","parseFilePaths","values","sharedStrings","parseSharedStrings","styles","parseStyles","properties","parseProperties","getSheets","sheets","map","_ref","sheetId","getSheetId","createSheetNotFoundError","parseSheet","rowIndexSourceMap","data","getData","_sheet","relationId","_iterator","_step","sheetsList","join"],"sources":["../../source/xlsx/parseXlsxFileContents.js"],"sourcesContent":["import parseProperties from './parseProperties.js'\r\nimport parseFilePaths from './parseFilePaths.js'\r\nimport parseStyles from './parseStyles.js'\r\nimport parseSharedStrings from './parseSharedStrings.js'\r\nimport parseSheet from './parseSheet.js'\r\nimport getData from './getData.js'\r\n\r\n// For an introduction in reading `*.xlsx` files see \"The minimum viable XLSX reader\":\r\n// https://www.brendanlong.com/the-minimum-viable-xlsx-reader.html\r\n\r\n/**\r\n * Reads data from an `.xlsx` spreadsheet.\r\n * @param {Record<string,string>} contents - A map of XML files inside XLSX file (which is just a zipped directory).\r\n * @param {object} xml — An object with a function `createDocument(string)`.\r\n * @param {number?} options.sheet - Workbook sheet id (`1` by default).\r\n * @param {string?} options.dateFormat - Date format, e.g. \"mm/dd/yyyy\". Values having this format template set will be parsed as dates.\r\n * @return {object} An object of shape `{ data, cells, properties }`. `data: string[][]` is an array of rows, each row being an array of cell values. `cells: string[][]` is an array of rows, each row being an array of cells. `properties: object` is the spreadsheet properties (e.g. whether date epoch is 1904 instead of 1900).\r\n */\r\nexport default function parseXlsxFileContents(contents, xml, options = {}) {\r\n if (!options.sheet) {\r\n options = {\r\n sheet: 1,\r\n ...options\r\n }\r\n }\r\n\r\n const getXmlFileContent = (filePath) => {\r\n if (!contents[filePath]) {\r\n throw new Error(`\"${filePath}\" file not found inside the *.xlsx file zip archive`)\r\n }\r\n return contents[filePath]\r\n }\r\n\r\n // Read the paths to certain files inside the `.xlsx` `.zip` archive.\r\n // These paths aren't standardized between different spreadsheet editors.\r\n // https://github.com/tidyverse/readxl/issues/104\r\n const filePaths = parseFilePaths(getXmlFileContent('xl/_rels/workbook.xml.rels'), xml)\r\n\r\n // Usual file path for \"shared strings\": \"xl/sharedStrings.xml\".\r\n const values = filePaths.sharedStrings\r\n ? parseSharedStrings(getXmlFileContent(filePaths.sharedStrings), xml)\r\n : []\r\n\r\n // Usual file path for \"styles\": \"xl/styles.xml\".\r\n const styles = filePaths.styles\r\n ? parseStyles(getXmlFileContent(filePaths.styles), xml)\r\n : {}\r\n\r\n const properties = parseProperties(getXmlFileContent('xl/workbook.xml'), xml)\r\n\r\n // A feature for getting the list of sheets in an Excel file.\r\n // https://github.com/catamphetamine/read-excel-file/issues/14\r\n if (options.getSheets) {\r\n return properties.sheets.map(({ name }) => ({\r\n name\r\n }))\r\n }\r\n\r\n // Find the sheet by name, or take the first one.\r\n const sheetId = getSheetId(options.sheet, properties.sheets)\r\n\r\n // If the sheet wasn't found then throw an error.\r\n // Example: \"xl/worksheets/sheet1.xml\".\r\n if (!sheetId || !filePaths.sheets[sheetId]) {\r\n throw createSheetNotFoundError(options.sheet, properties.sheets)\r\n }\r\n\r\n // Parse sheet data.\r\n const sheet = parseSheet(\r\n getXmlFileContent(filePaths.sheets[sheetId]),\r\n xml,\r\n values,\r\n styles,\r\n properties,\r\n options\r\n )\r\n\r\n options = {\r\n // Create a `rowIndexSourceMap` for the original dataset, if not passed,\r\n // because \"empty\" rows will be dropped from the input data.\r\n rowIndexSourceMap: [],\r\n ...options\r\n }\r\n\r\n // Get spreadsheet data.\r\n const data = getData(sheet, options)\r\n\r\n // Can return properties, if required.\r\n if (options.properties) {\r\n return {\r\n data,\r\n properties\r\n }\r\n }\r\n\r\n // Return spreadsheet data.\r\n return data\r\n}\r\n\r\nfunction getSheetId(sheet, sheets) {\r\n if (typeof sheet === 'number') {\r\n const _sheet = sheets[sheet - 1]\r\n return _sheet && _sheet.relationId\r\n }\r\n for (const _sheet of sheets) {\r\n if (_sheet.name === sheet) {\r\n return _sheet.relationId\r\n }\r\n }\r\n}\r\n\r\nfunction createSheetNotFoundError(sheet, sheets) {\r\n const sheetsList = sheets && sheets.map((sheet, i) => `\"${sheet.name}\" (#${i + 1})`).join(', ')\r\n return new Error(`Sheet ${typeof sheet === 'number' ? '#' + sheet : '\"' + sheet + '\"'} not found in the *.xlsx file.${sheets ? ' Available sheets: ' + sheetsList + '.' : ''}`)\r\n}"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAN,sBAAA,CAAAC,OAAA;AAAkC,SAAAD,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBA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IAAI,CAAC;EAC/F,OAAO,IAAI3B,KAAK,UAAAC,MAAA,CAAU,OAAOJ,KAAK,KAAK,QAAQ,GAAG,GAAG,GAAGA,KAAK,GAAG,GAAG,GAAGA,KAAK,GAAG,GAAG,oCAAAI,MAAA,CAAiCW,MAAM,GAAG,qBAAqB,GAAGc,UAAU,GAAG,GAAG,GAAG,EAAE,CAAE,CAAC;AACjL"}
@@ -4,8 +4,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports["default"] = readXlsxFileContents;
8
- var _readXlsx = _interopRequireDefault(require("./readXlsx.js"));
7
+ exports["default"] = parseXlsxFileContentsWithOptionalSchema;
8
+ var _parseXlsxFileContents = _interopRequireDefault(require("./parseXlsxFileContents.js"));
9
9
  var _mapToObjects = _interopRequireDefault(require("./schema/mapToObjects.js"));
10
10
  var _excluded = ["schema"];
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -16,16 +16,23 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
16
16
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
17
17
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
18
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
19
- function readXlsxFileContents(entries, xml, _ref) {
19
+ /**
20
+ * Reads data from an `.xlsx` spreadsheet.
21
+ * @param {Record<string,string>} contents — A map of XML files inside XLSX file (which is just a zipped directory).
22
+ * @param {object} xml — An object with a function `createDocument(string)`.
23
+ * @param {object} options
24
+ * @returns Spreadsheet data
25
+ */
26
+ function parseXlsxFileContentsWithOptionalSchema(contents, xml, _ref) {
20
27
  var schema = _ref.schema,
21
28
  options = _objectWithoutProperties(_ref, _excluded);
22
29
  if (options.map) {
23
30
  throw new Error('`map` option was removed. Pass a `schema` option instead.');
24
31
  }
25
- // `readXlsx()` function creates `options.rowIndexSourceMap` property.
32
+ // `parseXlsxFileContents()` function creates `options.rowIndexSourceMap` property.
26
33
  // It maps parsed data row indexes to spreadsheet row indexes.
27
34
  // That's because empty rows are ignored (discarded) when parsing using `schema`.
28
- var result = (0, _readXlsx["default"])(entries, xml, _objectSpread(_objectSpread({}, options), {}, {
35
+ var result = (0, _parseXlsxFileContents["default"])(contents, xml, _objectSpread(_objectSpread({}, options), {}, {
29
36
  properties: schema || options.properties
30
37
  }));
31
38
  if (schema) {
@@ -35,4 +42,4 @@ function readXlsxFileContents(entries, xml, _ref) {
35
42
  }
36
43
  return result;
37
44
  }
38
- //# sourceMappingURL=readXlsxFileContents.js.map
45
+ //# sourceMappingURL=parseXlsxFileContentsWithOptionalSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseXlsxFileContentsWithOptionalSchema.js","names":["_parseXlsxFileContents","_interopRequireDefault","require","_mapToObjects","_excluded","obj","__esModule","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","_typeof","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","i","sourceSymbolKeys","indexOf","prototype","propertyIsEnumerable","sourceKeys","parseXlsxFileContentsWithOptionalSchema","contents","xml","_ref","schema","options","map","Error","result","parseXlsxFileContents","properties","mapToObjects","data"],"sources":["../../source/xlsx/parseXlsxFileContentsWithOptionalSchema.js"],"sourcesContent":["import parseXlsxFileContents from './parseXlsxFileContents.js'\r\n\r\nimport mapToObjects from './schema/mapToObjects.js'\r\n\r\n/**\r\n * Reads data from an `.xlsx` spreadsheet.\r\n * @param {Record<string,string>} contents — A map of XML files inside XLSX file (which is just a zipped directory).\r\n * @param {object} xml — An object with a function `createDocument(string)`.\r\n * @param {object} options\r\n * @returns Spreadsheet data\r\n */\r\nexport default function parseXlsxFileContentsWithOptionalSchema(contents, xml, { schema, ...options }) {\r\n\tif (options.map) {\r\n\t\tthrow new Error('`map` option was removed. Pass a `schema` option instead.')\r\n\t}\r\n\t// `parseXlsxFileContents()` function creates `options.rowIndexSourceMap` property.\r\n\t// It maps parsed data row indexes to spreadsheet row indexes.\r\n\t// That's because empty rows are ignored (discarded) when parsing using `schema`.\r\n\tconst result = parseXlsxFileContents(contents, xml, {\r\n\t\t...options,\r\n\t\tproperties: schema || options.properties\r\n\t})\r\n\tif (schema) {\r\n\t\treturn mapToObjects(result.data, schema, {\r\n\t\t\t...options,\r\n\t\t\tproperties: result.properties\r\n\t\t})\r\n\t}\r\n\treturn result\r\n}"],"mappings":";;;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAmD,IAAAE,SAAA;AAAA,SAAAH,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,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AK,UAAA,CAAAnC,MAAA,EAAA8B,CAAA,MAAAxB,GAAA,GAAA6B,UAAA,CAAAL,CAAA,OAAAH,QAAA,CAAAK,OAAA,CAAA1B,GAAA,kBAAAsB,MAAA,CAAAtB,GAAA,IAAAoB,MAAA,CAAApB,GAAA,YAAAsB,MAAA;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASQ,uCAAuCA,CAACC,QAAQ,EAAEC,GAAG,EAAAC,IAAA,EAA0B;EAAA,IAAtBC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAKC,OAAO,GAAAhB,wBAAA,CAAAc,IAAA,EAAAzD,SAAA;EAClG,IAAI2D,OAAO,CAACC,GAAG,EAAE;IAChB,MAAM,IAAIC,KAAK,CAAC,2DAA2D,CAAC;EAC7E;EACA;EACA;EACA;EACA,IAAMC,MAAM,GAAG,IAAAC,iCAAqB,EAACR,QAAQ,EAAEC,GAAG,EAAAxC,aAAA,CAAAA,aAAA,KAC9C2C,OAAO;IACVK,UAAU,EAAEN,MAAM,IAAIC,OAAO,CAACK;EAAU,EACxC,CAAC;EACF,IAAIN,MAAM,EAAE;IACX,OAAO,IAAAO,wBAAY,EAACH,MAAM,CAACI,IAAI,EAAER,MAAM,EAAA1C,aAAA,CAAAA,aAAA,KACnC2C,OAAO;MACVK,UAAU,EAAEF,MAAM,CAACE;IAAU,EAC7B,CAAC;EACH;EACA,OAAOF,MAAM;AACd"}
@@ -167,10 +167,6 @@ function read(schema, row, rowIndex, path, columns, errors, options) {
167
167
  var _loop = function _loop() {
168
168
  var key = _Object$keys[_i];
169
169
  var schemaEntry = schema[key];
170
-
171
- // `schemaEntry.prop` property is now deprecated and shouldn't be used.
172
- // Instead, it now uses `key` as the key in the `object`.
173
- // And column name is now read not from `key` but from `schemaEntry.column` property.
174
170
  var propertyName = key;
175
171
  var columnTitle = schemaEntry.column;
176
172