read-excel-file 5.7.1 → 5.8.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.
- package/CHANGELOG.md +10 -0
- package/README.md +45 -19
- package/bundle/read-excel-file.min.js +1 -1
- package/bundle/read-excel-file.min.js.map +1 -1
- package/commonjs/read/coordinates.js +7 -10
- package/commonjs/read/coordinates.js.map +1 -1
- package/commonjs/read/dropEmptyColumns.js +6 -18
- package/commonjs/read/dropEmptyColumns.js.map +1 -1
- package/commonjs/read/dropEmptyColumns.test.js.map +1 -1
- package/commonjs/read/dropEmptyRows.js +11 -23
- package/commonjs/read/dropEmptyRows.js.map +1 -1
- package/commonjs/read/dropEmptyRows.test.js.map +1 -1
- package/commonjs/read/getData.js +31 -43
- package/commonjs/read/getData.js.map +1 -1
- package/commonjs/read/isDateTimestamp.js +51 -40
- package/commonjs/read/isDateTimestamp.js.map +1 -1
- package/commonjs/read/parseCell.js +3 -10
- package/commonjs/read/parseCell.js.map +1 -1
- package/commonjs/read/parseCellValue.js +28 -59
- package/commonjs/read/parseCellValue.js.map +1 -1
- package/commonjs/read/parseCells.js +3 -7
- package/commonjs/read/parseCells.js.map +1 -1
- package/commonjs/read/parseDate.js +5 -5
- package/commonjs/read/parseDate.js.map +1 -1
- package/commonjs/read/parseDate.test.js.map +1 -1
- package/commonjs/read/parseDimensions.js +6 -18
- package/commonjs/read/parseDimensions.js.map +1 -1
- package/commonjs/read/parseFilePaths.js +4 -11
- package/commonjs/read/parseFilePaths.js.map +1 -1
- package/commonjs/read/parseProperties.js +6 -8
- package/commonjs/read/parseProperties.js.map +1 -1
- package/commonjs/read/parseSharedStrings.js +0 -3
- package/commonjs/read/parseSharedStrings.js.map +1 -1
- package/commonjs/read/parseSheet.js +3 -7
- package/commonjs/read/parseSheet.js.map +1 -1
- package/commonjs/read/parseStyles.js +13 -21
- package/commonjs/read/parseStyles.js.map +1 -1
- package/commonjs/read/readSheetNamesBrowser.js +0 -3
- package/commonjs/read/readSheetNamesBrowser.js.map +1 -1
- package/commonjs/read/readSheetNamesNode.js +0 -3
- package/commonjs/read/readSheetNamesNode.js.map +1 -1
- package/commonjs/read/readSheetNamesNode.test.js.map +1 -1
- package/commonjs/read/readSheetNamesWebWorker.js +0 -3
- package/commonjs/read/readSheetNamesWebWorker.js.map +1 -1
- package/commonjs/read/readXlsx.js +34 -42
- package/commonjs/read/readXlsx.js.map +1 -1
- package/commonjs/read/readXlsxFileBrowser.js +0 -5
- package/commonjs/read/readXlsxFileBrowser.js.map +1 -1
- package/commonjs/read/readXlsxFileContents.js +12 -22
- package/commonjs/read/readXlsxFileContents.js.map +1 -1
- package/commonjs/read/readXlsxFileNode.js +0 -5
- package/commonjs/read/readXlsxFileNode.js.map +1 -1
- package/commonjs/read/readXlsxFileNode.test.js.map +1 -1
- package/commonjs/read/readXlsxFileWebWorker.js +0 -5
- package/commonjs/read/readXlsxFileWebWorker.js.map +1 -1
- package/commonjs/read/schema/convertMapToSchema.js +1 -8
- package/commonjs/read/schema/convertMapToSchema.js.map +1 -1
- package/commonjs/read/schema/convertMapToSchema.test.js.map +1 -1
- package/commonjs/read/schema/convertToJson.js +143 -142
- package/commonjs/read/schema/convertToJson.js.map +1 -1
- package/commonjs/read/schema/convertToJson.legacy.js +60 -0
- package/commonjs/read/schema/convertToJson.legacy.js.map +1 -0
- package/commonjs/read/schema/convertToJson.legacy.test.js.map +1 -0
- package/commonjs/read/schema/convertToJson.spreadsheet.js +25 -0
- package/commonjs/read/schema/convertToJson.spreadsheet.js.map +1 -0
- package/commonjs/read/schema/convertToJson.spreadsheet.test.js.map +1 -0
- package/commonjs/read/schema/convertToJson.test.js.map +1 -1
- package/commonjs/read/unpackXlsxFileBrowser.js +3 -9
- package/commonjs/read/unpackXlsxFileBrowser.js.map +1 -1
- package/commonjs/read/unpackXlsxFileNode.js +9 -15
- package/commonjs/read/unpackXlsxFileNode.js.map +1 -1
- package/commonjs/types/Boolean.js +0 -4
- package/commonjs/types/Boolean.js.map +1 -1
- package/commonjs/types/Date.js +0 -12
- package/commonjs/types/Date.js.map +1 -1
- package/commonjs/types/Email.js +0 -7
- package/commonjs/types/Email.js.map +1 -1
- package/commonjs/types/Email.test.js.map +1 -1
- package/commonjs/types/Integer.js +0 -7
- package/commonjs/types/Integer.js.map +1 -1
- package/commonjs/types/Integer.test.js.map +1 -1
- package/commonjs/types/InvalidError.js +8 -28
- package/commonjs/types/InvalidError.js.map +1 -1
- package/commonjs/types/Number.js +2 -10
- package/commonjs/types/Number.js.map +1 -1
- package/commonjs/types/String.js +4 -11
- package/commonjs/types/String.js.map +1 -1
- package/commonjs/types/URL.js +5 -8
- package/commonjs/types/URL.js.map +1 -1
- package/commonjs/types/URL.test.js.map +1 -1
- package/commonjs/xml/dom.js +6 -25
- package/commonjs/xml/dom.js.map +1 -1
- package/commonjs/xml/xlsx.js +1 -24
- package/commonjs/xml/xlsx.js.map +1 -1
- package/commonjs/xml/xml.js +1 -4
- package/commonjs/xml/xml.js.map +1 -1
- package/commonjs/xml/xmlBrowser.js +1 -2
- package/commonjs/xml/xmlBrowser.js.map +1 -1
- package/commonjs/xml/xpath/xlsx-xpath.js +3 -16
- package/commonjs/xml/xpath/xlsx-xpath.js.map +1 -1
- package/commonjs/xml/xpath/xpathBrowser.js +3 -5
- package/commonjs/xml/xpath/xpathBrowser.js.map +1 -1
- package/commonjs/xml/xpath/xpathNode.js +1 -5
- package/commonjs/xml/xpath/xpathNode.js.map +1 -1
- package/map/index.cjs +2 -0
- package/map/index.cjs.js +7 -0
- package/map/index.d.ts +11 -0
- package/map/index.js +1 -0
- package/map/package.json +17 -0
- package/modules/read/coordinates.js +7 -8
- package/modules/read/coordinates.js.map +1 -1
- package/modules/read/dropEmptyColumns.js +6 -17
- package/modules/read/dropEmptyColumns.js.map +1 -1
- package/modules/read/dropEmptyColumns.test.js.map +1 -1
- package/modules/read/dropEmptyRows.js +11 -22
- package/modules/read/dropEmptyRows.js.map +1 -1
- package/modules/read/dropEmptyRows.test.js.map +1 -1
- package/modules/read/getData.js +31 -39
- package/modules/read/getData.js.map +1 -1
- package/modules/read/isDateTimestamp.js +52 -39
- package/modules/read/isDateTimestamp.js.map +1 -1
- package/modules/read/parseCell.js +6 -6
- package/modules/read/parseCell.js.map +1 -1
- package/modules/read/parseCellValue.js +30 -55
- package/modules/read/parseCellValue.js.map +1 -1
- package/modules/read/parseCells.js +3 -3
- package/modules/read/parseCells.js.map +1 -1
- package/modules/read/parseDate.js +5 -4
- package/modules/read/parseDate.js.map +1 -1
- package/modules/read/parseDate.test.js.map +1 -1
- package/modules/read/parseDimensions.js +9 -17
- package/modules/read/parseDimensions.js.map +1 -1
- package/modules/read/parseFilePaths.js +5 -10
- package/modules/read/parseFilePaths.js.map +1 -1
- package/modules/read/parseProperties.js +8 -7
- package/modules/read/parseProperties.js.map +1 -1
- package/modules/read/parseSharedStrings.js +0 -1
- package/modules/read/parseSharedStrings.js.map +1 -1
- package/modules/read/parseSheet.js +3 -2
- package/modules/read/parseSheet.js.map +1 -1
- package/modules/read/parseStyles.js +16 -21
- package/modules/read/parseStyles.js.map +1 -1
- package/modules/read/readSheetNamesBrowser.js +1 -1
- package/modules/read/readSheetNamesBrowser.js.map +1 -1
- package/modules/read/readSheetNamesNode.js +1 -1
- package/modules/read/readSheetNamesNode.js.map +1 -1
- package/modules/read/readSheetNamesNode.test.js.map +1 -1
- package/modules/read/readSheetNamesWebWorker.js +1 -1
- package/modules/read/readSheetNamesWebWorker.js.map +1 -1
- package/modules/read/readXlsx.js +37 -35
- package/modules/read/readXlsx.js.map +1 -1
- package/modules/read/readXlsxFileBrowser.js +1 -1
- package/modules/read/readXlsxFileBrowser.js.map +1 -1
- package/modules/read/readXlsxFileContents.js +12 -17
- package/modules/read/readXlsxFileContents.js.map +1 -1
- package/modules/read/readXlsxFileNode.js +1 -1
- package/modules/read/readXlsxFileNode.js.map +1 -1
- package/modules/read/readXlsxFileNode.test.js.map +1 -1
- package/modules/read/readXlsxFileWebWorker.js +1 -1
- package/modules/read/readXlsxFileWebWorker.js.map +1 -1
- package/modules/read/schema/convertMapToSchema.js +1 -7
- package/modules/read/schema/convertMapToSchema.js.map +1 -1
- package/modules/read/schema/convertMapToSchema.test.js.map +1 -1
- package/modules/read/schema/convertToJson.js +143 -133
- package/modules/read/schema/convertToJson.js.map +1 -1
- package/modules/read/schema/convertToJson.legacy.js +53 -0
- package/modules/read/schema/convertToJson.legacy.js.map +1 -0
- package/modules/read/schema/convertToJson.legacy.test.js.map +1 -0
- package/modules/read/schema/convertToJson.spreadsheet.js +19 -0
- package/modules/read/schema/convertToJson.spreadsheet.js.map +1 -0
- package/modules/read/schema/convertToJson.spreadsheet.test.js.map +1 -0
- package/modules/read/schema/convertToJson.test.js.map +1 -1
- package/modules/read/unpackXlsxFileBrowser.js +4 -7
- package/modules/read/unpackXlsxFileBrowser.js.map +1 -1
- package/modules/read/unpackXlsxFileNode.js +9 -7
- package/modules/read/unpackXlsxFileNode.js.map +1 -1
- package/modules/types/Boolean.js +0 -1
- package/modules/types/Boolean.js.map +1 -1
- package/modules/types/Date.js +0 -8
- package/modules/types/Date.js.map +1 -1
- package/modules/types/Email.js +0 -2
- package/modules/types/Email.js.map +1 -1
- package/modules/types/Email.test.js.map +1 -1
- package/modules/types/Integer.js +0 -2
- package/modules/types/Integer.js.map +1 -1
- package/modules/types/Integer.test.js.map +1 -1
- package/modules/types/InvalidError.js +7 -25
- package/modules/types/InvalidError.js.map +1 -1
- package/modules/types/Number.js +2 -7
- package/modules/types/Number.js.map +1 -1
- package/modules/types/String.js +4 -8
- package/modules/types/String.js.map +1 -1
- package/modules/types/URL.js +5 -4
- package/modules/types/URL.js.map +1 -1
- package/modules/types/URL.test.js.map +1 -1
- package/modules/xml/dom.js +6 -18
- package/modules/xml/dom.js.map +1 -1
- package/modules/xml/xlsx.js +4 -13
- package/modules/xml/xlsx.js.map +1 -1
- package/modules/xml/xml.js.map +1 -1
- package/modules/xml/xmlBrowser.js.map +1 -1
- package/modules/xml/xpath/xlsx-xpath.js +2 -1
- package/modules/xml/xpath/xlsx-xpath.js.map +1 -1
- package/modules/xml/xpath/xpathBrowser.js +3 -4
- package/modules/xml/xpath/xpathBrowser.js.map +1 -1
- package/modules/xml/xpath/xpathNode.js +1 -0
- package/modules/xml/xpath/xpathNode.js.map +1 -1
- package/package.json +6 -1
- package/schema/index.cjs +2 -2
- package/schema/index.cjs.js +2 -2
- package/schema/index.d.ts +7 -2
- package/schema/index.js +1 -1
- package/types.d.ts +25 -2
package/commonjs/xml/dom.js
CHANGED
|
@@ -9,50 +9,40 @@ exports.forEach = forEach;
|
|
|
9
9
|
exports.getOuterXml = getOuterXml;
|
|
10
10
|
exports.getTagName = getTagName;
|
|
11
11
|
exports.map = map;
|
|
12
|
-
|
|
13
12
|
function findChild(node, tagName) {
|
|
14
13
|
var i = 0;
|
|
15
|
-
|
|
16
14
|
while (i < node.childNodes.length) {
|
|
17
|
-
var childNode = node.childNodes[i];
|
|
15
|
+
var childNode = node.childNodes[i];
|
|
16
|
+
// `nodeType: 1` means "Element".
|
|
18
17
|
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
19
|
-
|
|
20
18
|
if (childNode.nodeType === 1 && getTagName(childNode) === tagName) {
|
|
21
19
|
return childNode;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
i++;
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
function findChildren(node, tagName) {
|
|
29
25
|
var results = [];
|
|
30
26
|
var i = 0;
|
|
31
|
-
|
|
32
27
|
while (i < node.childNodes.length) {
|
|
33
|
-
var childNode = node.childNodes[i];
|
|
28
|
+
var childNode = node.childNodes[i];
|
|
29
|
+
// `nodeType: 1` means "Element".
|
|
34
30
|
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
35
|
-
|
|
36
31
|
if (childNode.nodeType === 1 && getTagName(childNode) === tagName) {
|
|
37
32
|
results.push(childNode);
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
i++;
|
|
41
35
|
}
|
|
42
|
-
|
|
43
36
|
return results;
|
|
44
37
|
}
|
|
45
|
-
|
|
46
38
|
function forEach(node, tagName, func) {
|
|
47
39
|
// if (typeof tagName === 'function') {
|
|
48
40
|
// func = tagName
|
|
49
41
|
// tagName = undefined
|
|
50
42
|
// }
|
|
51
43
|
var i = 0;
|
|
52
|
-
|
|
53
44
|
while (i < node.childNodes.length) {
|
|
54
45
|
var childNode = node.childNodes[i];
|
|
55
|
-
|
|
56
46
|
if (tagName) {
|
|
57
47
|
// `nodeType: 1` means "Element".
|
|
58
48
|
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
@@ -62,11 +52,9 @@ function forEach(node, tagName, func) {
|
|
|
62
52
|
} else {
|
|
63
53
|
func(childNode, i);
|
|
64
54
|
}
|
|
65
|
-
|
|
66
55
|
i++;
|
|
67
56
|
}
|
|
68
57
|
}
|
|
69
|
-
|
|
70
58
|
function map(node, tagName, func) {
|
|
71
59
|
var results = [];
|
|
72
60
|
forEach(node, tagName, function (node, i) {
|
|
@@ -74,9 +62,7 @@ function map(node, tagName, func) {
|
|
|
74
62
|
});
|
|
75
63
|
return results;
|
|
76
64
|
}
|
|
77
|
-
|
|
78
65
|
var NAMESPACE_REG_EXP = /.+\:/;
|
|
79
|
-
|
|
80
66
|
function getTagName(element) {
|
|
81
67
|
// For some weird reason, if an element is declared as,
|
|
82
68
|
// for example, `<x:sheets/>`, then its `.tagName` will be
|
|
@@ -86,32 +72,27 @@ function getTagName(element) {
|
|
|
86
72
|
// when getting `.tagName`, so just replacing anything
|
|
87
73
|
// before a colon, if any.
|
|
88
74
|
return element.tagName.replace(NAMESPACE_REG_EXP, '');
|
|
89
|
-
}
|
|
90
|
-
|
|
75
|
+
}
|
|
91
76
|
|
|
77
|
+
// This function is only used for occasional debug messages.
|
|
92
78
|
function getOuterXml(node) {
|
|
93
79
|
// `nodeType: 1` means "Element".
|
|
94
80
|
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
95
81
|
if (node.nodeType !== 1) {
|
|
96
82
|
return node.textContent;
|
|
97
83
|
}
|
|
98
|
-
|
|
99
84
|
var xml = '<' + getTagName(node);
|
|
100
85
|
var j = 0;
|
|
101
|
-
|
|
102
86
|
while (j < node.attributes.length) {
|
|
103
87
|
xml += ' ' + node.attributes[j].name + '=' + '"' + node.attributes[j].value + '"';
|
|
104
88
|
j++;
|
|
105
89
|
}
|
|
106
|
-
|
|
107
90
|
xml += '>';
|
|
108
91
|
var i = 0;
|
|
109
|
-
|
|
110
92
|
while (i < node.childNodes.length) {
|
|
111
93
|
xml += getOuterXml(node.childNodes[i]);
|
|
112
94
|
i++;
|
|
113
95
|
}
|
|
114
|
-
|
|
115
96
|
xml += '</' + getTagName(node) + '>';
|
|
116
97
|
return xml;
|
|
117
98
|
}
|
package/commonjs/xml/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","names":["findChild","node","tagName","i","childNodes","length","childNode","nodeType","getTagName","findChildren","results","push","forEach","func","map","NAMESPACE_REG_EXP","element","replace","getOuterXml","textContent","xml","j","attributes","name","value"],"sources":["../../source/xml/dom.js"],"sourcesContent":["export function findChild(node, tagName) {\r\n\tlet i = 0\r\n\twhile (i < node.childNodes.length) {\r\n\t\tconst childNode = node.childNodes[i]\r\n\t\t// `nodeType: 1` means \"Element\".\r\n\t\t// https://www.w3schools.com/xml/prop_element_nodetype.asp\r\n\t\tif (childNode.nodeType === 1 && getTagName(childNode) === tagName) {\r\n\t\t\treturn childNode\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n}\r\n\r\nexport function findChildren(node, tagName) {\r\n\tconst results = []\r\n\tlet i = 0\r\n\twhile (i < node.childNodes.length) {\r\n\t\tconst childNode = node.childNodes[i]\r\n\t\t// `nodeType: 1` means \"Element\".\r\n\t\t// https://www.w3schools.com/xml/prop_element_nodetype.asp\r\n\t\tif (childNode.nodeType === 1 && getTagName(childNode) === tagName) {\r\n\t\t\tresults.push(childNode)\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n\treturn results\r\n}\r\n\r\nexport function forEach(node, tagName, func) {\r\n\t// if (typeof tagName === 'function') {\r\n\t// \tfunc = tagName\r\n\t// \ttagName = undefined\r\n\t// }\r\n\tlet i = 0\r\n\twhile (i < node.childNodes.length) {\r\n\t\tconst childNode = node.childNodes[i]\r\n\t\tif (tagName) {\r\n\t\t\t// `nodeType: 1` means \"Element\".\r\n\t\t\t// https://www.w3schools.com/xml/prop_element_nodetype.asp\r\n\t\t\tif (childNode.nodeType === 1 && getTagName(childNode) === tagName) {\r\n\t\t\t\tfunc(childNode, i)\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfunc(childNode, i)\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n}\r\n\r\nexport function map(node, tagName, func) {\r\n\tconst results = []\r\n\tforEach(node, tagName, (node, i) => {\r\n\t\tresults.push(func(node, i))\r\n\t})\r\n\treturn results\r\n}\r\n\r\nconst NAMESPACE_REG_EXP = /.+\\:/\r\nexport function getTagName(element) {\r\n\t// For some weird reason, if an element is declared as,\r\n\t// for example, `<x:sheets/>`, then its `.tagName` will be\r\n\t// \"x:sheets\" instead of just \"sheets\".\r\n\t// https://gitlab.com/catamphetamine/read-excel-file/-/issues/25\r\n\t// Its not clear how to tell it to ignore any namespaces\r\n\t// when getting `.tagName`, so just replacing anything\r\n\t// before a colon, if any.\r\n\treturn element.tagName.replace(NAMESPACE_REG_EXP, '')\r\n}\r\n\r\n// This function is only used for occasional debug messages.\r\nexport function getOuterXml(node) {\r\n\t// `nodeType: 1` means \"Element\".\r\n\t// https://www.w3schools.com/xml/prop_element_nodetype.asp\r\n\tif (node.nodeType !== 1) {\r\n\t\treturn node.textContent\r\n\t}\r\n\r\n let xml = '<' + getTagName(node)\r\n\r\n let j = 0\r\n while (j < node.attributes.length) {\r\n xml += ' ' + node.attributes[j].name + '=' + '\"' + node.attributes[j].value + '\"'\r\n j++\r\n }\r\n\r\n xml += '>'\r\n\r\n let i = 0\r\n while (i < node.childNodes.length) {\r\n \txml += getOuterXml(node.childNodes[i])\r\n i++\r\n }\r\n\r\n xml += '</' + getTagName(node) + '>'\r\n\r\n return xml\r\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dom.js","names":["findChild","node","tagName","i","childNodes","length","childNode","nodeType","getTagName","findChildren","results","push","forEach","func","map","NAMESPACE_REG_EXP","element","replace","getOuterXml","textContent","xml","j","attributes","name","value"],"sources":["../../source/xml/dom.js"],"sourcesContent":["export function findChild(node, tagName) {\r\n\tlet i = 0\r\n\twhile (i < node.childNodes.length) {\r\n\t\tconst childNode = node.childNodes[i]\r\n\t\t// `nodeType: 1` means \"Element\".\r\n\t\t// https://www.w3schools.com/xml/prop_element_nodetype.asp\r\n\t\tif (childNode.nodeType === 1 && getTagName(childNode) === tagName) {\r\n\t\t\treturn childNode\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n}\r\n\r\nexport function findChildren(node, tagName) {\r\n\tconst results = []\r\n\tlet i = 0\r\n\twhile (i < node.childNodes.length) {\r\n\t\tconst childNode = node.childNodes[i]\r\n\t\t// `nodeType: 1` means \"Element\".\r\n\t\t// https://www.w3schools.com/xml/prop_element_nodetype.asp\r\n\t\tif (childNode.nodeType === 1 && getTagName(childNode) === tagName) {\r\n\t\t\tresults.push(childNode)\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n\treturn results\r\n}\r\n\r\nexport function forEach(node, tagName, func) {\r\n\t// if (typeof tagName === 'function') {\r\n\t// \tfunc = tagName\r\n\t// \ttagName = undefined\r\n\t// }\r\n\tlet i = 0\r\n\twhile (i < node.childNodes.length) {\r\n\t\tconst childNode = node.childNodes[i]\r\n\t\tif (tagName) {\r\n\t\t\t// `nodeType: 1` means \"Element\".\r\n\t\t\t// https://www.w3schools.com/xml/prop_element_nodetype.asp\r\n\t\t\tif (childNode.nodeType === 1 && getTagName(childNode) === tagName) {\r\n\t\t\t\tfunc(childNode, i)\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfunc(childNode, i)\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n}\r\n\r\nexport function map(node, tagName, func) {\r\n\tconst results = []\r\n\tforEach(node, tagName, (node, i) => {\r\n\t\tresults.push(func(node, i))\r\n\t})\r\n\treturn results\r\n}\r\n\r\nconst NAMESPACE_REG_EXP = /.+\\:/\r\nexport function getTagName(element) {\r\n\t// For some weird reason, if an element is declared as,\r\n\t// for example, `<x:sheets/>`, then its `.tagName` will be\r\n\t// \"x:sheets\" instead of just \"sheets\".\r\n\t// https://gitlab.com/catamphetamine/read-excel-file/-/issues/25\r\n\t// Its not clear how to tell it to ignore any namespaces\r\n\t// when getting `.tagName`, so just replacing anything\r\n\t// before a colon, if any.\r\n\treturn element.tagName.replace(NAMESPACE_REG_EXP, '')\r\n}\r\n\r\n// This function is only used for occasional debug messages.\r\nexport function getOuterXml(node) {\r\n\t// `nodeType: 1` means \"Element\".\r\n\t// https://www.w3schools.com/xml/prop_element_nodetype.asp\r\n\tif (node.nodeType !== 1) {\r\n\t\treturn node.textContent\r\n\t}\r\n\r\n let xml = '<' + getTagName(node)\r\n\r\n let j = 0\r\n while (j < node.attributes.length) {\r\n xml += ' ' + node.attributes[j].name + '=' + '\"' + node.attributes[j].value + '\"'\r\n j++\r\n }\r\n\r\n xml += '>'\r\n\r\n let i = 0\r\n while (i < node.childNodes.length) {\r\n \txml += getOuterXml(node.childNodes[i])\r\n i++\r\n }\r\n\r\n xml += '</' + getTagName(node) + '>'\r\n\r\n return xml\r\n}"],"mappings":";;;;;;;;;;;AAAO,SAASA,SAASA,CAACC,IAAI,EAAEC,OAAO,EAAE;EACxC,IAAIC,CAAC,GAAG,CAAC;EACT,OAAOA,CAAC,GAAGF,IAAI,CAACG,UAAU,CAACC,MAAM,EAAE;IAClC,IAAMC,SAAS,GAAGL,IAAI,CAACG,UAAU,CAACD,CAAC,CAAC;IACpC;IACA;IACA,IAAIG,SAAS,CAACC,QAAQ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ports.getSharedStrings = getSharedStrings;
|
|
16
16
|
exports.getSheets = getSheets;
|
|
17
17
|
exports.getWorkbookProperties = getWorkbookProperties;
|
|
18
|
-
|
|
19
18
|
var _dom = require("./dom.js");
|
|
20
|
-
|
|
21
19
|
// Returns an array of cells,
|
|
22
20
|
// each element being an XML DOM element representing a cell.
|
|
23
21
|
function getCells(document) {
|
|
@@ -31,86 +29,68 @@ function getCells(document) {
|
|
|
31
29
|
});
|
|
32
30
|
return cells;
|
|
33
31
|
}
|
|
34
|
-
|
|
35
32
|
function getMergedCells(document) {
|
|
36
33
|
var worksheet = document.documentElement;
|
|
37
34
|
var mergedCells = (0, _dom.findChild)(worksheet, 'mergeCells');
|
|
38
35
|
var mergedCellsInfo = [];
|
|
39
|
-
|
|
40
36
|
if (mergedCells) {
|
|
41
37
|
(0, _dom.forEach)(mergedCells, 'mergeCell', function (mergedCell) {
|
|
42
38
|
mergedCellsInfo.push(mergedCell.getAttribute('ref'));
|
|
43
39
|
});
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
return mergedCellsInfo;
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
function getCellValue(document, node) {
|
|
50
44
|
return (0, _dom.findChild)(node, 'v');
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
function getCellInlineStringValue(document, node) {
|
|
54
47
|
if (node.firstChild && (0, _dom.getTagName)(node.firstChild) === 'is' && node.firstChild.firstChild && (0, _dom.getTagName)(node.firstChild.firstChild) === 't') {
|
|
55
48
|
return node.firstChild.firstChild.textContent;
|
|
56
49
|
}
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
function getDimensions(document) {
|
|
60
52
|
var worksheet = document.documentElement;
|
|
61
53
|
var dimensions = (0, _dom.findChild)(worksheet, 'dimension');
|
|
62
|
-
|
|
63
54
|
if (dimensions) {
|
|
64
55
|
return dimensions.getAttribute('ref');
|
|
65
56
|
}
|
|
66
57
|
}
|
|
67
|
-
|
|
68
58
|
function getBaseStyles(document) {
|
|
69
59
|
var styleSheet = document.documentElement;
|
|
70
60
|
var cellStyleXfs = (0, _dom.findChild)(styleSheet, 'cellStyleXfs');
|
|
71
|
-
|
|
72
61
|
if (cellStyleXfs) {
|
|
73
62
|
return (0, _dom.findChildren)(cellStyleXfs, 'xf');
|
|
74
63
|
}
|
|
75
|
-
|
|
76
64
|
return [];
|
|
77
65
|
}
|
|
78
|
-
|
|
79
66
|
function getCellStyles(document) {
|
|
80
67
|
var styleSheet = document.documentElement;
|
|
81
68
|
var cellXfs = (0, _dom.findChild)(styleSheet, 'cellXfs');
|
|
82
|
-
|
|
83
69
|
if (!cellXfs) {
|
|
84
70
|
return [];
|
|
85
71
|
}
|
|
86
|
-
|
|
87
72
|
return (0, _dom.findChildren)(cellXfs, 'xf');
|
|
88
73
|
}
|
|
89
|
-
|
|
90
74
|
function getNumberFormats(document) {
|
|
91
75
|
var styleSheet = document.documentElement;
|
|
92
76
|
var numberFormats = [];
|
|
93
77
|
var numFmts = (0, _dom.findChild)(styleSheet, 'numFmts');
|
|
94
|
-
|
|
95
78
|
if (numFmts) {
|
|
96
79
|
return (0, _dom.findChildren)(numFmts, 'numFmt');
|
|
97
80
|
}
|
|
98
|
-
|
|
99
81
|
return [];
|
|
100
82
|
}
|
|
101
|
-
|
|
102
83
|
function getSharedStrings(document) {
|
|
103
84
|
// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` ("rich formatting") elements having `<t/>`.
|
|
104
85
|
// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1
|
|
105
86
|
// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html
|
|
87
|
+
|
|
106
88
|
var sst = document.documentElement;
|
|
107
89
|
return (0, _dom.map)(sst, 'si', function (string) {
|
|
108
90
|
var t = (0, _dom.findChild)(string, 't');
|
|
109
|
-
|
|
110
91
|
if (t) {
|
|
111
92
|
return t.textContent;
|
|
112
93
|
}
|
|
113
|
-
|
|
114
94
|
var value = '';
|
|
115
95
|
(0, _dom.forEach)(string, 'r', function (r) {
|
|
116
96
|
value += (0, _dom.findChild)(r, 't').textContent;
|
|
@@ -118,17 +98,14 @@ function getSharedStrings(document) {
|
|
|
118
98
|
return value;
|
|
119
99
|
});
|
|
120
100
|
}
|
|
121
|
-
|
|
122
101
|
function getWorkbookProperties(document) {
|
|
123
102
|
var workbook = document.documentElement;
|
|
124
103
|
return (0, _dom.findChild)(workbook, 'workbookPr');
|
|
125
104
|
}
|
|
126
|
-
|
|
127
105
|
function getRelationships(document) {
|
|
128
106
|
var relationships = document.documentElement;
|
|
129
107
|
return (0, _dom.findChildren)(relationships, 'Relationship');
|
|
130
108
|
}
|
|
131
|
-
|
|
132
109
|
function getSheets(document) {
|
|
133
110
|
var workbook = document.documentElement;
|
|
134
111
|
var sheets = (0, _dom.findChild)(workbook, 'sheets');
|
package/commonjs/xml/xlsx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xlsx.js","names":["getCells","document","worksheet","documentElement","sheetData","findChild","cells","forEach","row","cell","push","getMergedCells","mergedCells","mergedCellsInfo","mergedCell","getAttribute","getCellValue","node","getCellInlineStringValue","firstChild","getTagName","textContent","getDimensions","dimensions","getBaseStyles","styleSheet","cellStyleXfs","findChildren","getCellStyles","cellXfs","getNumberFormats","numberFormats","numFmts","getSharedStrings","sst","map","string","t","value","r","getWorkbookProperties","workbook","getRelationships","relationships","getSheets","sheets"],"sources":["../../source/xml/xlsx.js"],"sourcesContent":["import { findChild, findChildren, forEach, map, getTagName } from './dom.js'\r\n\r\n// Returns an array of cells,\r\n// each element being an XML DOM element representing a cell.\r\nexport function getCells(document) {\r\n const worksheet = document.documentElement\r\n const sheetData = findChild(worksheet, 'sheetData')\r\n\r\n const cells = []\r\n forEach(sheetData, 'row', (row) => {\r\n forEach(row, 'c', (cell) => {\r\n cells.push(cell)\r\n })\r\n })\r\n return cells\r\n}\r\n\r\nexport function getMergedCells(document) {\r\n const worksheet = document.documentElement\r\n const mergedCells = findChild(worksheet, 'mergeCells')\r\n const mergedCellsInfo = []\r\n if (mergedCells) {\r\n forEach(mergedCells, 'mergeCell', (mergedCell) => {\r\n mergedCellsInfo.push(mergedCell.getAttribute('ref'))\r\n })\r\n }\r\n return mergedCellsInfo\r\n}\r\n\r\nexport function getCellValue(document, node) {\r\n return findChild(node, 'v')\r\n}\r\n\r\nexport function getCellInlineStringValue(document, node) {\r\n if (\r\n node.firstChild &&\r\n getTagName(node.firstChild) === 'is' &&\r\n node.firstChild.firstChild &&\r\n getTagName(node.firstChild.firstChild) === 't'\r\n ) {\r\n return node.firstChild.firstChild.textContent\r\n }\r\n}\r\n\r\nexport function getDimensions(document) {\r\n const worksheet = document.documentElement\r\n const dimensions = findChild(worksheet, 'dimension')\r\n if (dimensions) {\r\n return dimensions.getAttribute('ref')\r\n }\r\n}\r\n\r\nexport function getBaseStyles(document) {\r\n const styleSheet = document.documentElement\r\n const cellStyleXfs = findChild(styleSheet, 'cellStyleXfs')\r\n if (cellStyleXfs) {\r\n return findChildren(cellStyleXfs, 'xf')\r\n }\r\n return []\r\n}\r\n\r\nexport function getCellStyles(document) {\r\n const styleSheet = document.documentElement\r\n const cellXfs = findChild(styleSheet, 'cellXfs')\r\n if (!cellXfs) {\r\n return []\r\n }\r\n return findChildren(cellXfs, 'xf')\r\n}\r\n\r\nexport function getNumberFormats(document) {\r\n const styleSheet = document.documentElement\r\n let numberFormats = []\r\n const numFmts = findChild(styleSheet, 'numFmts')\r\n if (numFmts) {\r\n return findChildren(numFmts, 'numFmt')\r\n }\r\n return []\r\n}\r\n\r\nexport function getSharedStrings(document) {\r\n\t// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` (\"rich formatting\") elements having `<t/>`.\r\n\t// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1\r\n\t// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html\r\n\r\n const sst = document.documentElement\r\n return map(sst, 'si', string => {\r\n const t = findChild(string, 't')\r\n if (t) {\r\n return t.textContent\r\n }\r\n let value = ''\r\n forEach(string, 'r', (r) => {\r\n value += findChild(r, 't').textContent\r\n })\r\n return value\r\n })\r\n}\r\n\r\nexport function getWorkbookProperties(document) {\r\n const workbook = document.documentElement\r\n return findChild(workbook, 'workbookPr')\r\n}\r\n\r\nexport function getRelationships(document) {\r\n const relationships = document.documentElement\r\n return findChildren(relationships, 'Relationship')\r\n}\r\n\r\nexport function getSheets(document) {\r\n const workbook = document.documentElement\r\n const sheets = findChild(workbook, 'sheets')\r\n return findChildren(sheets, 'sheet')\r\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"xlsx.js","names":["_dom","require","getCells","document","worksheet","documentElement","sheetData","findChild","cells","forEach","row","cell","push","getMergedCells","mergedCells","mergedCellsInfo","mergedCell","getAttribute","getCellValue","node","getCellInlineStringValue","firstChild","getTagName","textContent","getDimensions","dimensions","getBaseStyles","styleSheet","cellStyleXfs","findChildren","getCellStyles","cellXfs","getNumberFormats","numberFormats","numFmts","getSharedStrings","sst","map","string","t","value","r","getWorkbookProperties","workbook","getRelationships","relationships","getSheets","sheets"],"sources":["../../source/xml/xlsx.js"],"sourcesContent":["import { findChild, findChildren, forEach, map, getTagName } from './dom.js'\r\n\r\n// Returns an array of cells,\r\n// each element being an XML DOM element representing a cell.\r\nexport function getCells(document) {\r\n const worksheet = document.documentElement\r\n const sheetData = findChild(worksheet, 'sheetData')\r\n\r\n const cells = []\r\n forEach(sheetData, 'row', (row) => {\r\n forEach(row, 'c', (cell) => {\r\n cells.push(cell)\r\n })\r\n })\r\n return cells\r\n}\r\n\r\nexport function getMergedCells(document) {\r\n const worksheet = document.documentElement\r\n const mergedCells = findChild(worksheet, 'mergeCells')\r\n const mergedCellsInfo = []\r\n if (mergedCells) {\r\n forEach(mergedCells, 'mergeCell', (mergedCell) => {\r\n mergedCellsInfo.push(mergedCell.getAttribute('ref'))\r\n })\r\n }\r\n return mergedCellsInfo\r\n}\r\n\r\nexport function getCellValue(document, node) {\r\n return findChild(node, 'v')\r\n}\r\n\r\nexport function getCellInlineStringValue(document, node) {\r\n if (\r\n node.firstChild &&\r\n getTagName(node.firstChild) === 'is' &&\r\n node.firstChild.firstChild &&\r\n getTagName(node.firstChild.firstChild) === 't'\r\n ) {\r\n return node.firstChild.firstChild.textContent\r\n }\r\n}\r\n\r\nexport function getDimensions(document) {\r\n const worksheet = document.documentElement\r\n const dimensions = findChild(worksheet, 'dimension')\r\n if (dimensions) {\r\n return dimensions.getAttribute('ref')\r\n }\r\n}\r\n\r\nexport function getBaseStyles(document) {\r\n const styleSheet = document.documentElement\r\n const cellStyleXfs = findChild(styleSheet, 'cellStyleXfs')\r\n if (cellStyleXfs) {\r\n return findChildren(cellStyleXfs, 'xf')\r\n }\r\n return []\r\n}\r\n\r\nexport function getCellStyles(document) {\r\n const styleSheet = document.documentElement\r\n const cellXfs = findChild(styleSheet, 'cellXfs')\r\n if (!cellXfs) {\r\n return []\r\n }\r\n return findChildren(cellXfs, 'xf')\r\n}\r\n\r\nexport function getNumberFormats(document) {\r\n const styleSheet = document.documentElement\r\n let numberFormats = []\r\n const numFmts = findChild(styleSheet, 'numFmts')\r\n if (numFmts) {\r\n return findChildren(numFmts, 'numFmt')\r\n }\r\n return []\r\n}\r\n\r\nexport function getSharedStrings(document) {\r\n\t// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` (\"rich formatting\") elements having `<t/>`.\r\n\t// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1\r\n\t// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html\r\n\r\n const sst = document.documentElement\r\n return map(sst, 'si', string => {\r\n const t = findChild(string, 't')\r\n if (t) {\r\n return t.textContent\r\n }\r\n let value = ''\r\n forEach(string, 'r', (r) => {\r\n value += findChild(r, 't').textContent\r\n })\r\n return value\r\n })\r\n}\r\n\r\nexport function getWorkbookProperties(document) {\r\n const workbook = document.documentElement\r\n return findChild(workbook, 'workbookPr')\r\n}\r\n\r\nexport function getRelationships(document) {\r\n const relationships = document.documentElement\r\n return findChildren(relationships, 'Relationship')\r\n}\r\n\r\nexport function getSheets(document) {\r\n const workbook = document.documentElement\r\n const sheets = findChild(workbook, 'sheets')\r\n return findChildren(sheets, 'sheet')\r\n}"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAEA;AACA;AACO,SAASC,QAAQA,CAACC,QAAQ,EAAE;EACjC,IAAMC,SAAS,GAAGD,QAAQ,CAACE,eAAe;EAC1C,IAAMC,SAAS,GAAG,IAAAC,cAAS,EAACH,SAAS,EAAE,WAAW,CAAC;EAEnD,IAAMI,KAAK,GAAG,EAAE;EAChB,IAAAC,YAAO,EAACH,SAAS,EAAE,KAAK,EAAE,UAACI,GAAG,EAAK;IACjC,IAAAD,YAAO,EAACC,GAAG,EAAE,GAAG,EAAE,UAACC,IAAI,EAAK;MAC1BH,KAAK,CAACI,IAAI,CAACD,IAAI,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC,CAAC;EACF,OAAOH,KAAK;AACd;AAEO,SAASK,cAAcA,CAACV,QAAQ,EAAE;EACvC,IAAMC,SAAS,GAAGD,QAAQ,CAACE,eAAe;EAC1C,IAAMS,WAAW,GAAG,IAAAP,cAAS,EAACH,SAAS,EAAE,YAAY,CAAC;EACtD,IAAMW,eAAe,GAAG,EAAE;EAC1B,IAAID,WAAW,EAAE;IACf,IAAAL,YAAO,EAACK,WAAW,EAAE,WAAW,EAAE,UAACE,UAAU,EAAK;MAChDD,eAAe,CAACH,IAAI,CAACI,UAAU,CAACC,YAAY,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC,CAAC;EACJ;EACA,OAAOF,eAAe;AACxB;AAEO,SAASG,YAAYA,CAACf,QAAQ,EAAEgB,IAAI,EAAE;EAC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0C,MAAM,GAAG,IAAAxC,cAAS,EAACoC,QAAQ,EAAE,QAAQ,CAAC;EAC5C,OAAO,IAAAd,iBAAY,EAACkB,MAAM,EAAE,OAAO,CAAC;AACtC"}
|
package/commonjs/xml/xml.js
CHANGED
|
@@ -4,13 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _xmldom = require("@xmldom/xmldom");
|
|
9
|
-
|
|
10
|
-
var _default = {
|
|
8
|
+
var _default = exports["default"] = {
|
|
11
9
|
createDocument: function createDocument(content) {
|
|
12
10
|
return new _xmldom.DOMParser().parseFromString(content);
|
|
13
11
|
}
|
|
14
12
|
};
|
|
15
|
-
exports["default"] = _default;
|
|
16
13
|
//# sourceMappingURL=xml.js.map
|
package/commonjs/xml/xml.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml.js","names":["createDocument","content","DOMParser","parseFromString"],"sources":["../../source/xml/xml.js"],"sourcesContent":["import { DOMParser } from '@xmldom/xmldom'\r\n\r\nexport default {\r\n\tcreateDocument(content) {\r\n\t\treturn new DOMParser().parseFromString(content)\r\n\t}\r\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"xml.js","names":["_xmldom","require","_default","exports","createDocument","content","DOMParser","parseFromString"],"sources":["../../source/xml/xml.js"],"sourcesContent":["import { DOMParser } from '@xmldom/xmldom'\r\n\r\nexport default {\r\n\tcreateDocument(content) {\r\n\t\treturn new DOMParser().parseFromString(content)\r\n\t}\r\n}"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAA0C,IAAAC,QAAA,GAAAC,OAAA,cAE3B;EACdC,cAAc,WAAAA,eAACC,OAAO,EAAE;IACvB,OAAO,IAAIC,iBAAS,CAAC,CAAC,CAACC,eAAe,CAACF,OAAO,CAAC;EAChD;AACD,CAAC"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var _default = {
|
|
7
|
+
var _default = exports["default"] = {
|
|
8
8
|
createDocument: function createDocument(content) {
|
|
9
9
|
// if (!content) {
|
|
10
10
|
// throw new Error('No *.xml content')
|
|
@@ -14,5 +14,4 @@ var _default = {
|
|
|
14
14
|
return new DOMParser().parseFromString(content.trim(), 'text/xml');
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
exports["default"] = _default;
|
|
18
17
|
//# sourceMappingURL=xmlBrowser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xmlBrowser.js","names":["createDocument","content","DOMParser","parseFromString","trim"],"sources":["../../source/xml/xmlBrowser.js"],"sourcesContent":["export default {\r\n\tcreateDocument(content) {\r\n\t\t// if (!content) {\r\n\t\t// \tthrow new Error('No *.xml content')\r\n\t\t// }\r\n\t\t// A weird bug: it won't parse XML unless it's trimmed.\r\n\t\t// https://github.com/catamphetamine/read-excel-file/issues/21\r\n\t\treturn new DOMParser().parseFromString(content.trim(), 'text/xml')\r\n\t}\r\n}"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"xmlBrowser.js","names":["createDocument","content","DOMParser","parseFromString","trim"],"sources":["../../source/xml/xmlBrowser.js"],"sourcesContent":["export default {\r\n\tcreateDocument(content) {\r\n\t\t// if (!content) {\r\n\t\t// \tthrow new Error('No *.xml content')\r\n\t\t// }\r\n\t\t// A weird bug: it won't parse XML unless it's trimmed.\r\n\t\t// https://github.com/catamphetamine/read-excel-file/issues/21\r\n\t\treturn new DOMParser().parseFromString(content.trim(), 'text/xml')\r\n\t}\r\n}"],"mappings":";;;;;;oCAAe;EACdA,cAAc,WAAAA,eAACC,OAAO,EAAE;IACvB;IACA;IACA;IACA;IACA;IACA,OAAO,IAAIC,SAAS,CAAC,CAAC,CAACC,eAAe,CAACF,OAAO,CAACG,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC;EACnE;AACD,CAAC"}
|
|
@@ -15,12 +15,10 @@ exports.getRelationships = getRelationships;
|
|
|
15
15
|
exports.getSharedStrings = getSharedStrings;
|
|
16
16
|
exports.getSheets = getSheets;
|
|
17
17
|
exports.getWorkbookProperties = getWorkbookProperties;
|
|
18
|
-
|
|
19
18
|
var _xpathNode = _interopRequireDefault(require("./xpathNode"));
|
|
20
|
-
|
|
21
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
22
|
-
|
|
23
20
|
// This file is no longer used.
|
|
21
|
+
|
|
24
22
|
// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.
|
|
25
23
|
// https://github.com/catamphetamine/read-excel-file/issues/26
|
|
26
24
|
// The inclusion of `xpath` package in `./xpathNode`
|
|
@@ -31,6 +29,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
31
29
|
// for using `./xpathNode` instead of `./xpathBrowser`
|
|
32
30
|
// but this library has been migrated to not using `xpath` anyway.
|
|
33
31
|
// This code is just alternative/historical now, it seems.
|
|
32
|
+
|
|
34
33
|
var namespaces = {
|
|
35
34
|
a: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
|
|
36
35
|
// This one seems to be for `r:id` attributes on `<sheet>`s.
|
|
@@ -38,47 +37,38 @@ var namespaces = {
|
|
|
38
37
|
// This one seems to be for `<Relationships/>` file.
|
|
39
38
|
rr: 'http://schemas.openxmlformats.org/package/2006/relationships'
|
|
40
39
|
};
|
|
41
|
-
|
|
42
40
|
function getCells(document) {
|
|
43
41
|
return (0, _xpathNode["default"])(document, null, '/a:worksheet/a:sheetData/a:row/a:c', namespaces);
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
function getMergedCells(document) {
|
|
47
44
|
return (0, _xpathNode["default"])(document, null, '/a:worksheet/a:mergedCells/a:mergedCell/@ref', namespaces);
|
|
48
45
|
}
|
|
49
|
-
|
|
50
46
|
function getCellValue(document, node) {
|
|
51
47
|
return (0, _xpathNode["default"])(document, node, './a:v', namespaces)[0];
|
|
52
48
|
}
|
|
53
|
-
|
|
54
49
|
function getCellInlineStringValue(document, node) {
|
|
55
50
|
return (0, _xpathNode["default"])(document, node, './a:is/a:t', namespaces)[0].textContent;
|
|
56
51
|
}
|
|
57
|
-
|
|
58
52
|
function getDimensions(document) {
|
|
59
53
|
var dimensions = (0, _xpathNode["default"])(document, null, '/a:worksheet/a:dimension/@ref', namespaces)[0];
|
|
60
|
-
|
|
61
54
|
if (dimensions) {
|
|
62
55
|
return dimensions.textContent;
|
|
63
56
|
}
|
|
64
57
|
}
|
|
65
|
-
|
|
66
58
|
function getBaseStyles(document) {
|
|
67
59
|
return (0, _xpathNode["default"])(document, null, '/a:styleSheet/a:cellStyleXfs/a:xf', namespaces);
|
|
68
60
|
}
|
|
69
|
-
|
|
70
61
|
function getCellStyles(document) {
|
|
71
62
|
return (0, _xpathNode["default"])(document, null, '/a:styleSheet/a:cellXfs/a:xf', namespaces);
|
|
72
63
|
}
|
|
73
|
-
|
|
74
64
|
function getNumberFormats(document) {
|
|
75
65
|
return (0, _xpathNode["default"])(document, null, '/a:styleSheet/a:numFmts/a:numFmt', namespaces);
|
|
76
66
|
}
|
|
77
|
-
|
|
78
67
|
function getSharedStrings(document) {
|
|
79
68
|
// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` ("rich formatting") elements having `<t/>`.
|
|
80
69
|
// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1
|
|
81
70
|
// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html
|
|
71
|
+
|
|
82
72
|
// The ".//a:t[not(ancestor::a:rPh)]" selector means:
|
|
83
73
|
// "select all `<t/>` that are not children of `<rPh/>`".
|
|
84
74
|
// https://stackoverflow.com/questions/42773772/xpath-span-what-does-the-dot-mean
|
|
@@ -90,15 +80,12 @@ function getSharedStrings(document) {
|
|
|
90
80
|
}).join('');
|
|
91
81
|
});
|
|
92
82
|
}
|
|
93
|
-
|
|
94
83
|
function getWorkbookProperties(document) {
|
|
95
84
|
return (0, _xpathNode["default"])(document, null, '/a:workbook/a:workbookPr', namespaces)[0];
|
|
96
85
|
}
|
|
97
|
-
|
|
98
86
|
function getRelationships(document) {
|
|
99
87
|
return (0, _xpathNode["default"])(document, null, '/rr:Relationships/rr:Relationship', namespaces);
|
|
100
88
|
}
|
|
101
|
-
|
|
102
89
|
function getSheets(document) {
|
|
103
90
|
return (0, _xpathNode["default"])(document, null, '/a:workbook/a:sheets/a:sheet', namespaces);
|
|
104
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xlsx-xpath.js","names":["namespaces","a","r","rr","getCells","document","xpath","getMergedCells","getCellValue","node","getCellInlineStringValue","textContent","getDimensions","dimensions","getBaseStyles","getCellStyles","getNumberFormats","getSharedStrings","map","string","_","join","getWorkbookProperties","getRelationships","getSheets"],"sources":["../../../source/xml/xpath/xlsx-xpath.js"],"sourcesContent":["// This file is no longer used.\r\n\r\n// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nimport xpath from './xpathNode'\r\n\r\nconst namespaces = {\r\n a: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',\r\n // This one seems to be for `r:id` attributes on `<sheet>`s.\r\n r: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\r\n // This one seems to be for `<Relationships/>` file.\r\n rr: 'http://schemas.openxmlformats.org/package/2006/relationships'\r\n}\r\n\r\nexport function getCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:sheetData/a:row/a:c', namespaces)\r\n}\r\n\r\nexport function getMergedCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:mergedCells/a:mergedCell/@ref', namespaces)\r\n}\r\n\r\nexport function getCellValue(document, node) {\r\n return xpath(document, node, './a:v', namespaces)[0]\r\n}\r\n\r\nexport function getCellInlineStringValue(document, node) {\r\n return xpath(document, node, './a:is/a:t', namespaces)[0].textContent\r\n}\r\n\r\nexport function getDimensions(document) {\r\n const dimensions = xpath(document, null, '/a:worksheet/a:dimension/@ref', namespaces)[0]\r\n if (dimensions) {\r\n return dimensions.textContent\r\n }\r\n}\r\n\r\nexport function getBaseStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellStyleXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getCellStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getNumberFormats(document) {\r\n return xpath(document, null, '/a:styleSheet/a:numFmts/a:numFmt', namespaces)\r\n}\r\n\r\nexport function getSharedStrings(document) {\r\n\t// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` (\"rich formatting\") elements having `<t/>`.\r\n\t// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1\r\n\t// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html\r\n\r\n // The \".//a:t[not(ancestor::a:rPh)]\" selector means:\r\n // \"select all `<t/>` that are not children of `<rPh/>`\". \r\n\t// https://stackoverflow.com/questions/42773772/xpath-span-what-does-the-dot-mean\r\n // `<rPh><t></t></rPh>` seems to be some \"phonetic data\" added for languages like Japanese that should be ignored.\r\n // https://github.com/doy/spreadsheet-parsexlsx/issues/72\r\n return xpath(document, null, '/a:sst/a:si', namespaces)\r\n .map(string => xpath(document, string, './/a:t[not(ancestor::a:rPh)]', namespaces)\r\n .map(_ => _.textContent).join('')\r\n )\r\n}\r\n\r\nexport function getWorkbookProperties(document) {\r\n return xpath(document, null, '/a:workbook/a:workbookPr', namespaces)[0]\r\n}\r\n\r\nexport function getRelationships(document) {\r\n return xpath(document, null, '/rr:Relationships/rr:Relationship', namespaces)\r\n}\r\n\r\nexport function getSheets(document) {\r\n return xpath(document, null, '/a:workbook/a:sheets/a:sheet', namespaces)\r\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"xlsx-xpath.js","names":["_xpathNode","_interopRequireDefault","require","obj","__esModule","namespaces","a","r","rr","getCells","document","xpath","getMergedCells","getCellValue","node","getCellInlineStringValue","textContent","getDimensions","dimensions","getBaseStyles","getCellStyles","getNumberFormats","getSharedStrings","map","string","_","join","getWorkbookProperties","getRelationships","getSheets"],"sources":["../../../source/xml/xpath/xlsx-xpath.js"],"sourcesContent":["// This file is no longer used.\r\n\r\n// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nimport xpath from './xpathNode'\r\n\r\nconst namespaces = {\r\n a: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',\r\n // This one seems to be for `r:id` attributes on `<sheet>`s.\r\n r: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\r\n // This one seems to be for `<Relationships/>` file.\r\n rr: 'http://schemas.openxmlformats.org/package/2006/relationships'\r\n}\r\n\r\nexport function getCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:sheetData/a:row/a:c', namespaces)\r\n}\r\n\r\nexport function getMergedCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:mergedCells/a:mergedCell/@ref', namespaces)\r\n}\r\n\r\nexport function getCellValue(document, node) {\r\n return xpath(document, node, './a:v', namespaces)[0]\r\n}\r\n\r\nexport function getCellInlineStringValue(document, node) {\r\n return xpath(document, node, './a:is/a:t', namespaces)[0].textContent\r\n}\r\n\r\nexport function getDimensions(document) {\r\n const dimensions = xpath(document, null, '/a:worksheet/a:dimension/@ref', namespaces)[0]\r\n if (dimensions) {\r\n return dimensions.textContent\r\n }\r\n}\r\n\r\nexport function getBaseStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellStyleXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getCellStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getNumberFormats(document) {\r\n return xpath(document, null, '/a:styleSheet/a:numFmts/a:numFmt', namespaces)\r\n}\r\n\r\nexport function getSharedStrings(document) {\r\n\t// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` (\"rich formatting\") elements having `<t/>`.\r\n\t// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1\r\n\t// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html\r\n\r\n // The \".//a:t[not(ancestor::a:rPh)]\" selector means:\r\n // \"select all `<t/>` that are not children of `<rPh/>`\". \r\n\t// https://stackoverflow.com/questions/42773772/xpath-span-what-does-the-dot-mean\r\n // `<rPh><t></t></rPh>` seems to be some \"phonetic data\" added for languages like Japanese that should be ignored.\r\n // https://github.com/doy/spreadsheet-parsexlsx/issues/72\r\n return xpath(document, null, '/a:sst/a:si', namespaces)\r\n .map(string => xpath(document, string, './/a:t[not(ancestor::a:rPh)]', namespaces)\r\n .map(_ => _.textContent).join('')\r\n )\r\n}\r\n\r\nexport function getWorkbookProperties(document) {\r\n return xpath(document, null, '/a:workbook/a:workbookPr', namespaces)[0]\r\n}\r\n\r\nexport function getRelationships(document) {\r\n return xpath(document, null, '/rr:Relationships/rr:Relationship', namespaces)\r\n}\r\n\r\nexport function getSheets(document) {\r\n return xpath(document, null, '/a:workbook/a:sheets/a:sheet', namespaces)\r\n}"],"mappings":";;;;;;;;;;;;;;;;;AAYA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA+B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAZ/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,IAAME,UAAU,GAAG;EACjBC,CAAC,EAAE,2DAA2D;EAC9D;EACAC,CAAC,EAAE,qEAAqE;EACxE;EACAC,EAAE,EAAE;AACN,CAAC;AAEM,SAASC,QAAQA,CAACC,QAAQ,EAAE;EACjC,OAAO,IAAAC,qBAAK,EAACD,QAAQ,EAAE,IAAI,EAAE,oCAAoC,EAAEL,UAAU,CAAC;AAChF;AAEO,SAASO,cAAcA,CAACF,QAAQ,EAAE;EACvC,OAAO,IAAAC,qBAAK,EAACD,QAAQ,EAAE,IAAI,EAAE,8CAA8C,EAAEL,UAAU,CAAC;AAC1F;AAEO,SAASQ,YAAYA,CAACH,QAAQ,EAAEI,IAAI,EAAE;EAC3C,OAAO,IAAAH,qBAAK,EAACD,QAAQ,EAAEI,IAAI,EAAE,OAAO,EAAET,UAAU,CAAC,CAAC,CAAC,CAAC;AACtD;AAEO,SAASU,wBAAwBA,CAACL,QAAQ,EAAEI,IAAI,EAAE;EACvD,OAAO,IAAAH,qBAAK,EAACD,QAAQ,EAAEI,IAAI,EAAE,YAAY,EAAET,UAAU,CAAC,CAAC,CAAC,CAAC,CAACW,WAAW;AACvE;AAEO,SAASC,aAAaA,CAACP,QAAQ,EAAE;EACtC,IAAMQ,UAAU,GAAG,IAAAP,qBAAK,EAACD,QAAQ,EAAE,IAAI,EAAE,+BAA+B,EAAEL,UAAU,CAAC,CA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ClC,OAAO,IAAAC,qBAAK,EAACD,QAAQ,EAAE,IAAI,EAAE,8BAA8B,EAAEL,UAAU,CAAC;AAC1E"}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = xpath;
|
|
7
|
-
|
|
8
7
|
// This file is no longer used.
|
|
8
|
+
|
|
9
9
|
// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.
|
|
10
10
|
// https://github.com/catamphetamine/read-excel-file/issues/26
|
|
11
11
|
// The inclusion of `xpath` package in `./xpathNode`
|
|
@@ -20,16 +20,14 @@ function xpath(document, node, path) {
|
|
|
20
20
|
var namespaces = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
21
21
|
var nodes = document.evaluate(path, node || document, function (prefix) {
|
|
22
22
|
return namespaces[prefix];
|
|
23
|
-
}, XPathResult.ANY_TYPE, null);
|
|
24
|
-
|
|
23
|
+
}, XPathResult.ANY_TYPE, null);
|
|
24
|
+
// Convert iterator to an array.
|
|
25
25
|
var results = [];
|
|
26
26
|
var result = nodes.iterateNext();
|
|
27
|
-
|
|
28
27
|
while (result) {
|
|
29
28
|
results.push(result);
|
|
30
29
|
result = nodes.iterateNext();
|
|
31
30
|
}
|
|
32
|
-
|
|
33
31
|
return results;
|
|
34
32
|
}
|
|
35
33
|
//# sourceMappingURL=xpathBrowser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xpathBrowser.js","names":["xpath","document","node","path","namespaces","nodes","evaluate","prefix","XPathResult","ANY_TYPE","results","result","iterateNext","push"],"sources":["../../../source/xml/xpath/xpathBrowser.js"],"sourcesContent":["// This file is no longer used.\r\n\r\n// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nexport default function xpath(document, node, path, namespaces = {}) {\r\n\tconst nodes = document.evaluate(\r\n\t\tpath,\r\n\t\tnode || document,\r\n\t\tprefix => namespaces[prefix],\r\n\t\tXPathResult.ANY_TYPE,\r\n\t\tnull\r\n\t)\r\n\t// Convert iterator to an array.\r\n\tconst results = []\r\n\tlet result = nodes.iterateNext()\r\n\twhile (result) {\r\n\t\tresults.push(result)\r\n\t\tresult = nodes.iterateNext()\r\n\t}\r\n\treturn results\r\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"xpathBrowser.js","names":["xpath","document","node","path","namespaces","arguments","length","undefined","nodes","evaluate","prefix","XPathResult","ANY_TYPE","results","result","iterateNext","push"],"sources":["../../../source/xml/xpath/xpathBrowser.js"],"sourcesContent":["// This file is no longer used.\r\n\r\n// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nexport default function xpath(document, node, path, namespaces = {}) {\r\n\tconst nodes = document.evaluate(\r\n\t\tpath,\r\n\t\tnode || document,\r\n\t\tprefix => namespaces[prefix],\r\n\t\tXPathResult.ANY_TYPE,\r\n\t\tnull\r\n\t)\r\n\t// Convert iterator to an array.\r\n\tconst results = []\r\n\tlet result = nodes.iterateNext()\r\n\twhile (result) {\r\n\t\tresults.push(result)\r\n\t\tresult = nodes.iterateNext()\r\n\t}\r\n\treturn results\r\n}"],"mappings":";;;;;;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,KAAKA,CAACC,QAAQ,EAAEC,IAAI,EAAEC,IAAI,EAAmB;EAAA,IAAjBC,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAClE,IAAMG,KAAK,GAAGP,QAAQ,CAACQ,QAAQ,CAC9BN,IAAI,EACJD,IAAI,IAAID,QAAQ,EAChB,UAAAS,MAAM;IAAA,OAAIN,UAAU,CAACM,MAAM,CAAC;EAAA,GAC5BC,WAAW,CAACC,QAAQ,EACpB,IACD,CAAC;EACD;EACA,IAAMC,OAAO,GAAG,EAAE;EAClB,IAAIC,MAAM,GAAGN,KAAK,CAACO,WAAW,CAAC,CAAC;EAChC,OAAOD,MAAM,EAAE;IACdD,OAAO,CAACG,IAAI,CAACF,MAAM,CAAC;IACpBA,MAAM,GAAGN,KAAK,CAACO,WAAW,CAAC,CAAC;EAC7B;EACA,OAAOF,OAAO;AACf"}
|
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = _default;
|
|
7
|
-
|
|
8
7
|
var _xpath = _interopRequireDefault(require("xpath"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
// This file is no longer used.
|
|
10
|
+
|
|
13
11
|
function _default(document, node, path) {
|
|
14
12
|
var namespaces = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
15
|
-
|
|
16
13
|
var select = _xpath["default"].useNamespaces(namespaces);
|
|
17
|
-
|
|
18
14
|
return select(path, node || document);
|
|
19
15
|
}
|
|
20
16
|
//# sourceMappingURL=xpathNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xpathNode.js","names":["document","node","path","namespaces","select","xpath","useNamespaces"],"sources":["../../../source/xml/xpath/xpathNode.js"],"sourcesContent":["// This file is no longer used.\r\n\r\nimport xpath from 'xpath'\r\n\r\nexport default function(document, node, path, namespaces = {}) {\r\n\tconst select = xpath.useNamespaces(namespaces)\r\n\treturn select(path, node || document)\r\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"xpathNode.js","names":["_xpath","_interopRequireDefault","require","obj","__esModule","_default","document","node","path","namespaces","arguments","length","undefined","select","xpath","useNamespaces"],"sources":["../../../source/xml/xpath/xpathNode.js"],"sourcesContent":["// This file is no longer used.\r\n\r\nimport xpath from 'xpath'\r\n\r\nexport default function(document, node, path, namespaces = {}) {\r\n\tconst select = xpath.useNamespaces(namespaces)\r\n\treturn select(path, node || document)\r\n}"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyB,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAFzB;;AAIe,SAAAE,SAASC,QAAQ,EAAEC,IAAI,EAAEC,IAAI,EAAmB;EAAA,IAAjBC,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC5D,IAAMG,MAAM,GAAGC,iBAAK,CAACC,aAAa,CAACN,UAAU,CAAC;EAC9C,OAAOI,MAAM,CAACL,IAAI,EAAED,IAAI,IAAID,QAAQ,CAAC;AACtC"}
|
package/map/index.cjs
ADDED
package/map/index.cjs.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// This file is deprecated.
|
|
2
|
+
// It's the same as `index.cjs`, just with an added `*.js` extension.
|
|
3
|
+
// It fixes the issue when some software doesn't see files with `*.cjs` file extensions
|
|
4
|
+
// when used as the `main` property value in `package.json`.
|
|
5
|
+
|
|
6
|
+
exports = module.exports = require('../commonjs/read/schema/convertToJson.js').default
|
|
7
|
+
exports['default'] = require('../commonjs/read/schema/convertToJson.js').default
|
package/map/index.d.ts
ADDED
package/map/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as default } from '../modules/read/schema/convertToJson.js'
|
package/map/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"name": "read-excel-file/schema",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"main": "index.cjs",
|
|
6
|
+
"module": "index.js",
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./index.d.ts",
|
|
12
|
+
"import": "./index.js",
|
|
13
|
+
"require": "./index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false
|
|
17
|
+
}
|