read-excel-file 5.7.0 → 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 +26 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Integer.js","names":["InvalidError","NumberType","Integer","value","isInteger","x"],"sources":["../../source/types/Integer.js"],"sourcesContent":["import InvalidError from './InvalidError.js'\r\nimport NumberType from './Number.js'\r\n\r\nexport default function Integer(value) {\r\n\tvalue = NumberType(value)\r\n if (!isInteger(value)) {\r\n throw new InvalidError('not_an_integer')\r\n }\r\n return value\r\n}\r\n\r\nexport function isInteger(x) {\r\n\t// https://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript\r\n\treturn (x | 0) === x\r\n}"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"Integer.js","names":["InvalidError","NumberType","Integer","value","isInteger","x"],"sources":["../../source/types/Integer.js"],"sourcesContent":["import InvalidError from './InvalidError.js'\r\nimport NumberType from './Number.js'\r\n\r\nexport default function Integer(value) {\r\n\tvalue = NumberType(value)\r\n if (!isInteger(value)) {\r\n throw new InvalidError('not_an_integer')\r\n }\r\n return value\r\n}\r\n\r\nexport function isInteger(x) {\r\n\t// https://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript\r\n\treturn (x | 0) === x\r\n}"],"mappings":"AAAA,OAAOA,YAAY,MAAM,mBAAmB;AAC5C,OAAOC,UAAU,MAAM,aAAa;AAEpC,eAAe,SAASC,OAAOA,CAACC,KAAK,EAAE;EACtCA,KAAK,GAAGF,UAAU,CAACE,KAAK,CAAC;EACxB,IAAI,CAACC,SAAS,CAACD,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIH,YAAY,CAAC,gBAAgB,CAAC;EAC1C;EACA,OAAOG,KAAK;AACd;AAEA,OAAO,SAASC,SAASA,CAACC,CAAC,EAAE;EAC5B;EACA,OAAO,CAACA,CAAC,GAAG,CAAC,MAAMA,CAAC;AACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Integer.test.js","names":["isInteger","describe","it","should","equal"],"sources":["../../source/types/Integer.test.js"],"sourcesContent":["import { isInteger } from './Integer.js'\r\n\r\ndescribe('Integer', () => {\r\n\tit('should validate an Integer', () => {\r\n\t\t// isInteger('1.2').should.equal(false)\r\n\t\t// isInteger('1').should.equal(true)\r\n\t\tisInteger(1.2).should.equal(false)\r\n\t\tisInteger(1).should.equal(true)\r\n\t})\r\n})"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"file":"Integer.test.js","names":["isInteger","describe","it","should","equal"],"sources":["../../source/types/Integer.test.js"],"sourcesContent":["import { isInteger } from './Integer.js'\r\n\r\ndescribe('Integer', () => {\r\n\tit('should validate an Integer', () => {\r\n\t\t// isInteger('1.2').should.equal(false)\r\n\t\t// isInteger('1').should.equal(true)\r\n\t\tisInteger(1.2).should.equal(false)\r\n\t\tisInteger(1).should.equal(true)\r\n\t})\r\n})"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExCC,QAAQ,CAAC,SAAS,EAAE,YAAM;EACzBC,EAAE,CAAC,4BAA4B,EAAE,YAAM;IACtC;IACA;IACAF,SAAS,CAAC,GAAG,CAAC,CAACG,MAAM,CAACC,KAAK,CAAC,KAAK,CAAC;IAClCJ,SAAS,CAAC,CAAC,CAAC,CAACG,MAAM,CAACC,KAAK,CAAC,IAAI,CAAC;EAChC,CAAC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,48 +1,30 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
|
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
5
3
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
-
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
|
+
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); }
|
|
7
6
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
-
|
|
9
7
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
-
|
|
11
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
9
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
14
|
-
|
|
15
10
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
16
|
-
|
|
17
11
|
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
18
|
-
|
|
19
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
20
|
-
|
|
12
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
21
13
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
|
-
|
|
23
14
|
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
24
|
-
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
|
-
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
29
17
|
var InvalidError = /*#__PURE__*/function (_Error) {
|
|
30
18
|
_inherits(InvalidError, _Error);
|
|
31
|
-
|
|
32
19
|
var _super = _createSuper(InvalidError);
|
|
33
|
-
|
|
34
20
|
function InvalidError(reason) {
|
|
35
21
|
var _this;
|
|
36
|
-
|
|
37
22
|
_classCallCheck(this, InvalidError);
|
|
38
|
-
|
|
39
23
|
_this = _super.call(this, 'invalid');
|
|
40
24
|
_this.reason = reason;
|
|
41
25
|
return _this;
|
|
42
26
|
}
|
|
43
|
-
|
|
44
27
|
return _createClass(InvalidError);
|
|
45
28
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
46
|
-
|
|
47
29
|
export { InvalidError as default };
|
|
48
30
|
//# sourceMappingURL=InvalidError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvalidError.js","names":["InvalidError","reason","Error"],"sources":["../../source/types/InvalidError.js"],"sourcesContent":["export default class InvalidError extends Error {\r\n constructor(reason) {\r\n super('invalid')\r\n this.reason = reason\r\n }\r\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InvalidError.js","names":["InvalidError","_Error","_inherits","_super","_createSuper","reason","_this","_classCallCheck","call","_createClass","_wrapNativeSuper","Error","default"],"sources":["../../source/types/InvalidError.js"],"sourcesContent":["export default class InvalidError extends Error {\r\n constructor(reason) {\r\n super('invalid')\r\n this.reason = reason\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;IAAqBA,YAAY,0BAAAC,MAAA;EAAAC,SAAA,CAAAF,YAAA,EAAAC,MAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,YAAA;EAC/B,SAAAA,aAAYK,MAAM,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAP,YAAA;IAClBM,KAAA,GAAAH,MAAA,CAAAK,IAAA,OAAM,SAAS;IACfF,KAAA,CAAKD,MAAM,GAAGA,MAAM;IAAA,OAAAC,KAAA;EACtB;EAAC,OAAAG,YAAA,CAAAT,YAAA;AAAA,gBAAAU,gBAAA,CAJuCC,KAAK;AAAA,SAA1BX,YAAY,IAAAY,OAAA"}
|
package/modules/types/Number.js
CHANGED
|
@@ -11,19 +11,17 @@ export default function NumberType(value) {
|
|
|
11
11
|
if (typeof value === 'string') {
|
|
12
12
|
var stringifiedValue = value;
|
|
13
13
|
value = Number(value);
|
|
14
|
-
|
|
15
14
|
if (String(value) !== stringifiedValue) {
|
|
16
15
|
throw new InvalidError('not_a_number');
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
if (typeof value !== 'number') {
|
|
21
19
|
throw new InvalidError('not_a_number');
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
if (isNaN(value)) {
|
|
25
22
|
throw new InvalidError('invalid_number');
|
|
26
|
-
}
|
|
23
|
+
}
|
|
24
|
+
// At this point, `value` can only be a number.
|
|
27
25
|
//
|
|
28
26
|
// The global `isFinite()` function filters out:
|
|
29
27
|
// * NaN
|
|
@@ -32,12 +30,9 @@ export default function NumberType(value) {
|
|
|
32
30
|
//
|
|
33
31
|
// All other values pass (including non-numbers).
|
|
34
32
|
//
|
|
35
|
-
|
|
36
|
-
|
|
37
33
|
if (!isFinite(value)) {
|
|
38
34
|
throw new InvalidError('out_of_bounds');
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
return value;
|
|
42
37
|
}
|
|
43
38
|
//# sourceMappingURL=Number.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Number.js","names":["InvalidError","NumberType","value","stringifiedValue","Number","String","isNaN","isFinite"],"sources":["../../source/types/Number.js"],"sourcesContent":["import InvalidError from './InvalidError.js'\r\n\r\nexport default function NumberType(value) {\r\n // An XLSX file editing software might not always correctly\r\n // detect numeric values in string-type cells. Users won't bother\r\n // manually selecting a cell type, so the editing software has to guess\r\n // based on the user's input. One can assume that such auto-detection\r\n // might not always work.\r\n //\r\n // So, if a cell is supposed to be a numeric one, convert a string value to a number.\r\n //\r\n if (typeof value === 'string') {\r\n const stringifiedValue = value\r\n value = Number(value)\r\n if (String(value) !== stringifiedValue) {\r\n throw new InvalidError('not_a_number')\r\n }\r\n }\r\n if (typeof value !== 'number') {\r\n throw new InvalidError('not_a_number')\r\n }\r\n if (isNaN(value)) {\r\n throw new InvalidError('invalid_number')\r\n }\r\n // At this point, `value` can only be a number.\r\n //\r\n // The global `isFinite()` function filters out:\r\n // * NaN\r\n // * -Infinity\r\n // * Infinity\r\n //\r\n // All other values pass (including non-numbers).\r\n //\r\n if (!isFinite(value)) {\r\n throw new InvalidError('out_of_bounds')\r\n }\r\n return value\r\n}"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"Number.js","names":["InvalidError","NumberType","value","stringifiedValue","Number","String","isNaN","isFinite"],"sources":["../../source/types/Number.js"],"sourcesContent":["import InvalidError from './InvalidError.js'\r\n\r\nexport default function NumberType(value) {\r\n // An XLSX file editing software might not always correctly\r\n // detect numeric values in string-type cells. Users won't bother\r\n // manually selecting a cell type, so the editing software has to guess\r\n // based on the user's input. One can assume that such auto-detection\r\n // might not always work.\r\n //\r\n // So, if a cell is supposed to be a numeric one, convert a string value to a number.\r\n //\r\n if (typeof value === 'string') {\r\n const stringifiedValue = value\r\n value = Number(value)\r\n if (String(value) !== stringifiedValue) {\r\n throw new InvalidError('not_a_number')\r\n }\r\n }\r\n if (typeof value !== 'number') {\r\n throw new InvalidError('not_a_number')\r\n }\r\n if (isNaN(value)) {\r\n throw new InvalidError('invalid_number')\r\n }\r\n // At this point, `value` can only be a number.\r\n //\r\n // The global `isFinite()` function filters out:\r\n // * NaN\r\n // * -Infinity\r\n // * Infinity\r\n //\r\n // All other values pass (including non-numbers).\r\n //\r\n if (!isFinite(value)) {\r\n throw new InvalidError('out_of_bounds')\r\n }\r\n return value\r\n}"],"mappings":"AAAA,OAAOA,YAAY,MAAM,mBAAmB;AAE5C,eAAe,SAASC,UAAUA,CAACC,KAAK,EAAE;EACxC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,IAAMC,gBAAgB,GAAGD,KAAK;IAC9BA,KAAK,GAAGE,MAAM,CAACF,KAAK,CAAC;IACrB,IAAIG,MAAM,CAACH,KAAK,CAAC,KAAKC,gBAAgB,EAAE;MACtC,MAAM,IAAIH,YAAY,CAAC,cAAc,CAAC;IACxC;EACF;EACA,IAAI,OAAOE,KAAK,KAAK,QAAQ,EAAE;IAC7B,MAAM,IAAIF,YAAY,CAAC,cAAc,CAAC;EACxC;EACA,IAAIM,KAAK,CAACJ,KAAK,CAAC,EAAE;IAChB,MAAM,IAAIF,YAAY,CAAC,gBAAgB,CAAC;EAC1C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAI,CAACO,QAAQ,CAACL,KAAK,CAAC,EAAE;IACpB,MAAM,IAAIF,YAAY,CAAC,eAAe,CAAC;EACzC;EACA,OAAOE,KAAK;AACd"}
|
package/modules/types/String.js
CHANGED
|
@@ -2,7 +2,8 @@ import InvalidError from './InvalidError.js';
|
|
|
2
2
|
export default function StringType(value) {
|
|
3
3
|
if (typeof value === 'string') {
|
|
4
4
|
return value;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
|
+
// Excel tends to perform a forced automatic convertion of string-type values
|
|
6
7
|
// to number-type ones when the user has input them. Otherwise, users wouldn't
|
|
7
8
|
// be able to perform formula calculations on those cell values because users
|
|
8
9
|
// won't bother manually choosing a "numeric" cell type for each cell, and
|
|
@@ -12,27 +13,22 @@ export default function StringType(value) {
|
|
|
12
13
|
// So, if a cell value is supposed to be a string and Excel has automatically
|
|
13
14
|
// converted it to a number, perform a backwards conversion.
|
|
14
15
|
//
|
|
15
|
-
|
|
16
|
-
|
|
17
16
|
if (typeof value === 'number') {
|
|
18
17
|
if (isNaN(value)) {
|
|
19
18
|
throw new InvalidError('invalid_number');
|
|
20
|
-
}
|
|
19
|
+
}
|
|
20
|
+
// The global `isFinite()` function filters out:
|
|
21
21
|
// * NaN
|
|
22
22
|
// * -Infinity
|
|
23
23
|
// * Infinity
|
|
24
24
|
//
|
|
25
25
|
// All other values pass (including non-numbers).
|
|
26
26
|
//
|
|
27
|
-
|
|
28
|
-
|
|
29
27
|
if (!isFinite(value)) {
|
|
30
28
|
throw new InvalidError('out_of_bounds');
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
return String(value);
|
|
34
31
|
}
|
|
35
|
-
|
|
36
32
|
throw new InvalidError('not_a_string');
|
|
37
33
|
}
|
|
38
34
|
//# sourceMappingURL=String.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"String.js","names":["InvalidError","StringType","value","isNaN","isFinite","String"],"sources":["../../source/types/String.js"],"sourcesContent":["import InvalidError from './InvalidError.js'\r\n\r\nexport default function StringType(value) {\r\n if (typeof value === 'string') {\r\n return value\r\n }\r\n // Excel tends to perform a forced automatic convertion of string-type values\r\n // to number-type ones when the user has input them. Otherwise, users wouldn't\r\n // be able to perform formula calculations on those cell values because users\r\n // won't bother manually choosing a \"numeric\" cell type for each cell, and\r\n // even if they did, choosing a \"numeric\" cell type every time wouldn't be an\r\n // acceptable \"user experience\".\r\n //\r\n // So, if a cell value is supposed to be a string and Excel has automatically\r\n // converted it to a number, perform a backwards conversion.\r\n //\r\n if (typeof value === 'number') {\r\n if (isNaN(value)) {\r\n throw new InvalidError('invalid_number')\r\n }\r\n // The global `isFinite()` function filters out:\r\n // * NaN\r\n // * -Infinity\r\n // * Infinity\r\n //\r\n // All other values pass (including non-numbers).\r\n //\r\n if (!isFinite(value)) {\r\n throw new InvalidError('out_of_bounds')\r\n }\r\n return String(value)\r\n }\r\n throw new InvalidError('not_a_string')\r\n}"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"String.js","names":["InvalidError","StringType","value","isNaN","isFinite","String"],"sources":["../../source/types/String.js"],"sourcesContent":["import InvalidError from './InvalidError.js'\r\n\r\nexport default function StringType(value) {\r\n if (typeof value === 'string') {\r\n return value\r\n }\r\n // Excel tends to perform a forced automatic convertion of string-type values\r\n // to number-type ones when the user has input them. Otherwise, users wouldn't\r\n // be able to perform formula calculations on those cell values because users\r\n // won't bother manually choosing a \"numeric\" cell type for each cell, and\r\n // even if they did, choosing a \"numeric\" cell type every time wouldn't be an\r\n // acceptable \"user experience\".\r\n //\r\n // So, if a cell value is supposed to be a string and Excel has automatically\r\n // converted it to a number, perform a backwards conversion.\r\n //\r\n if (typeof value === 'number') {\r\n if (isNaN(value)) {\r\n throw new InvalidError('invalid_number')\r\n }\r\n // The global `isFinite()` function filters out:\r\n // * NaN\r\n // * -Infinity\r\n // * Infinity\r\n //\r\n // All other values pass (including non-numbers).\r\n //\r\n if (!isFinite(value)) {\r\n throw new InvalidError('out_of_bounds')\r\n }\r\n return String(value)\r\n }\r\n throw new InvalidError('not_a_string')\r\n}"],"mappings":"AAAA,OAAOA,YAAY,MAAM,mBAAmB;AAE5C,eAAe,SAASC,UAAUA,CAACC,KAAK,EAAE;EACxC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,IAAIC,KAAK,CAACD,KAAK,CAAC,EAAE;MAChB,MAAM,IAAIF,YAAY,CAAC,gBAAgB,CAAC;IAC1C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,CAACI,QAAQ,CAACF,KAAK,CAAC,EAAE;MACpB,MAAM,IAAIF,YAAY,CAAC,eAAe,CAAC;IACzC;IACA,OAAOK,MAAM,CAACH,KAAK,CAAC;EACtB;EACA,MAAM,IAAIF,YAAY,CAAC,cAAc,CAAC;AACxC"}
|
package/modules/types/URL.js
CHANGED
|
@@ -4,12 +4,12 @@ export default function URL(value) {
|
|
|
4
4
|
if (isURL(value)) {
|
|
5
5
|
return value;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
7
|
throw new InvalidError('not_a_url');
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
throw new InvalidError('not_a_string');
|
|
12
|
-
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// URL regexp explanation:
|
|
13
13
|
//
|
|
14
14
|
// /^
|
|
15
15
|
//
|
|
@@ -64,8 +64,9 @@ export default function URL(value) {
|
|
|
64
64
|
//
|
|
65
65
|
// $/i
|
|
66
66
|
|
|
67
|
-
var regexp = /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)*(?:[a-z\u00a1-\uffff]{2,}))(?::\d{2,5})?(?:[/?#]\S*)?$/i;
|
|
67
|
+
var regexp = /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)*(?:[a-z\u00a1-\uffff]{2,}))(?::\d{2,5})?(?:[/?#]\S*)?$/i;
|
|
68
68
|
|
|
69
|
+
// https://stackoverflow.com/questions/8667070/javascript-regular-expression-to-validate-url
|
|
69
70
|
export function isURL(value) {
|
|
70
71
|
return regexp.test(value);
|
|
71
72
|
}
|
package/modules/types/URL.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URL.js","names":["InvalidError","URL","value","isURL","regexp","test"],"sources":["../../source/types/URL.js"],"sourcesContent":["import InvalidError from './InvalidError.js'\r\n\r\nexport default function URL(value) {\r\n if (typeof value === 'string') {\r\n if (isURL(value)) {\r\n return value\r\n }\r\n throw new InvalidError('not_a_url')\r\n }\r\n throw new InvalidError('not_a_string')\r\n}\r\n\r\n// URL regexp explanation:\r\n//\r\n// /^\r\n//\r\n// \t(?:\r\n// \t // Matches optional \"http(s):\" or \"ftp:\":\r\n// \t\t(?:\r\n// \t\t\t(?:https?|ftp):\r\n// \t\t)?\r\n//\r\n// \t // Matches \"//\" (required):\r\n// \t\t\\/\\/\r\n// \t)\r\n//\r\n// \t// Matches a valid non-local IP address:\r\n// \t(?:\r\n// \t\t(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])\r\n// \t\t(?:\r\n// \t\t\t\\.\r\n// \t\t\t(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])\r\n// \t\t){2}\r\n// \t\t(?:\r\n// \t\t\t\\.\r\n// \t\t\t(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4])\r\n// \t\t)\r\n//\r\n// \t // Or,\r\n// \t\t|\r\n//\r\n// \t // Matches an alpha-numeric domain name.\r\n// \t\t(?:\r\n// \t\t\t(?:\r\n// \t\t\t\t[a-z0-9\\u00a1-\\uffff]\r\n// \t\t\t\t[a-z0-9\\u00a1-\\uffff_-]{0,62}\r\n// \t\t\t)?\r\n// \t\t\t[a-z0-9\\u00a1-\\uffff]\r\n// \t\t\t\\.\r\n// \t\t)*\r\n// \t\t(?:\r\n// \t // Domain zone: \"com\", \"net\", etc (required):\r\n// \t\t\t[a-z\\u00a1-\\uffff]{2,}\r\n// \t\t)\r\n// \t)\r\n//\r\n// \t// Matches a colon and a port number:\r\n// \t(?::\\d{2,5})?\r\n//\r\n// \t// Matches everything after the \"origin\":\r\n// \t// * pathname\r\n// \t// * query\r\n// \t// * hash\r\n// \t(?:[/?#]\\S*)?\r\n//\r\n// $/i\r\n\r\nconst regexp = /^(?:(?:(?:https?|ftp):)?\\/\\/)(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)*(?:[a-z\\u00a1-\\uffff]{2,}))(?::\\d{2,5})?(?:[/?#]\\S*)?$/i\r\n\r\n// https://stackoverflow.com/questions/8667070/javascript-regular-expression-to-validate-url\r\nexport function isURL(value) {\r\n\treturn regexp.test(value)\r\n}"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"URL.js","names":["InvalidError","URL","value","isURL","regexp","test"],"sources":["../../source/types/URL.js"],"sourcesContent":["import InvalidError from './InvalidError.js'\r\n\r\nexport default function URL(value) {\r\n if (typeof value === 'string') {\r\n if (isURL(value)) {\r\n return value\r\n }\r\n throw new InvalidError('not_a_url')\r\n }\r\n throw new InvalidError('not_a_string')\r\n}\r\n\r\n// URL regexp explanation:\r\n//\r\n// /^\r\n//\r\n// \t(?:\r\n// \t // Matches optional \"http(s):\" or \"ftp:\":\r\n// \t\t(?:\r\n// \t\t\t(?:https?|ftp):\r\n// \t\t)?\r\n//\r\n// \t // Matches \"//\" (required):\r\n// \t\t\\/\\/\r\n// \t)\r\n//\r\n// \t// Matches a valid non-local IP address:\r\n// \t(?:\r\n// \t\t(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])\r\n// \t\t(?:\r\n// \t\t\t\\.\r\n// \t\t\t(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])\r\n// \t\t){2}\r\n// \t\t(?:\r\n// \t\t\t\\.\r\n// \t\t\t(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4])\r\n// \t\t)\r\n//\r\n// \t // Or,\r\n// \t\t|\r\n//\r\n// \t // Matches an alpha-numeric domain name.\r\n// \t\t(?:\r\n// \t\t\t(?:\r\n// \t\t\t\t[a-z0-9\\u00a1-\\uffff]\r\n// \t\t\t\t[a-z0-9\\u00a1-\\uffff_-]{0,62}\r\n// \t\t\t)?\r\n// \t\t\t[a-z0-9\\u00a1-\\uffff]\r\n// \t\t\t\\.\r\n// \t\t)*\r\n// \t\t(?:\r\n// \t // Domain zone: \"com\", \"net\", etc (required):\r\n// \t\t\t[a-z\\u00a1-\\uffff]{2,}\r\n// \t\t)\r\n// \t)\r\n//\r\n// \t// Matches a colon and a port number:\r\n// \t(?::\\d{2,5})?\r\n//\r\n// \t// Matches everything after the \"origin\":\r\n// \t// * pathname\r\n// \t// * query\r\n// \t// * hash\r\n// \t(?:[/?#]\\S*)?\r\n//\r\n// $/i\r\n\r\nconst regexp = /^(?:(?:(?:https?|ftp):)?\\/\\/)(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)*(?:[a-z\\u00a1-\\uffff]{2,}))(?::\\d{2,5})?(?:[/?#]\\S*)?$/i\r\n\r\n// https://stackoverflow.com/questions/8667070/javascript-regular-expression-to-validate-url\r\nexport function isURL(value) {\r\n\treturn regexp.test(value)\r\n}"],"mappings":"AAAA,OAAOA,YAAY,MAAM,mBAAmB;AAE5C,eAAe,SAASC,GAAGA,CAACC,KAAK,EAAE;EACjC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,IAAIC,KAAK,CAACD,KAAK,CAAC,EAAE;MAChB,OAAOA,KAAK;IACd;IACA,MAAM,IAAIF,YAAY,CAAC,WAAW,CAAC;EACrC;EACA,MAAM,IAAIA,YAAY,CAAC,cAAc,CAAC;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMI,MAAM,GAAG,+RAA+R;;AAE9S;AACA,OAAO,SAASD,KAAKA,CAACD,KAAK,EAAE;EAC5B,OAAOE,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC;AAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URL.test.js","names":["isURL","describe","it","should","equal"],"sources":["../../source/types/URL.test.js"],"sourcesContent":["import { isURL } from './URL.js'\r\n\r\ndescribe('URL', () => {\r\n\tit('should validate a URL', () => {\r\n\t\tisURL('123').should.equal(false)\r\n\t\tisURL('https://stackoverflow.com/questions/8667070/javascript-regular-expression-to-validate-url').should.equal(true)\r\n\t})\r\n})"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"file":"URL.test.js","names":["isURL","describe","it","should","equal"],"sources":["../../source/types/URL.test.js"],"sourcesContent":["import { isURL } from './URL.js'\r\n\r\ndescribe('URL', () => {\r\n\tit('should validate a URL', () => {\r\n\t\tisURL('123').should.equal(false)\r\n\t\tisURL('https://stackoverflow.com/questions/8667070/javascript-regular-expression-to-validate-url').should.equal(true)\r\n\t})\r\n})"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAEhCC,QAAQ,CAAC,KAAK,EAAE,YAAM;EACrBC,EAAE,CAAC,uBAAuB,EAAE,YAAM;IACjCF,KAAK,CAAC,KAAK,CAAC,CAACG,MAAM,CAACC,KAAK,CAAC,KAAK,CAAC;IAChCJ,KAAK,CAAC,2FAA2F,CAAC,CAACG,MAAM,CAACC,KAAK,CAAC,IAAI,CAAC;EACtH,CAAC,CAAC;AACH,CAAC,CAAC"}
|
package/modules/xml/dom.js
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
export function findChild(node, tagName) {
|
|
2
2
|
var i = 0;
|
|
3
|
-
|
|
4
3
|
while (i < node.childNodes.length) {
|
|
5
|
-
var childNode = node.childNodes[i];
|
|
4
|
+
var childNode = node.childNodes[i];
|
|
5
|
+
// `nodeType: 1` means "Element".
|
|
6
6
|
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
7
|
-
|
|
8
7
|
if (childNode.nodeType === 1 && getTagName(childNode) === tagName) {
|
|
9
8
|
return childNode;
|
|
10
9
|
}
|
|
11
|
-
|
|
12
10
|
i++;
|
|
13
11
|
}
|
|
14
12
|
}
|
|
15
13
|
export function findChildren(node, tagName) {
|
|
16
14
|
var results = [];
|
|
17
15
|
var i = 0;
|
|
18
|
-
|
|
19
16
|
while (i < node.childNodes.length) {
|
|
20
|
-
var childNode = node.childNodes[i];
|
|
17
|
+
var childNode = node.childNodes[i];
|
|
18
|
+
// `nodeType: 1` means "Element".
|
|
21
19
|
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
22
|
-
|
|
23
20
|
if (childNode.nodeType === 1 && getTagName(childNode) === tagName) {
|
|
24
21
|
results.push(childNode);
|
|
25
22
|
}
|
|
26
|
-
|
|
27
23
|
i++;
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
return results;
|
|
31
26
|
}
|
|
32
27
|
export function forEach(node, tagName, func) {
|
|
@@ -35,10 +30,8 @@ export function forEach(node, tagName, func) {
|
|
|
35
30
|
// tagName = undefined
|
|
36
31
|
// }
|
|
37
32
|
var i = 0;
|
|
38
|
-
|
|
39
33
|
while (i < node.childNodes.length) {
|
|
40
34
|
var childNode = node.childNodes[i];
|
|
41
|
-
|
|
42
35
|
if (tagName) {
|
|
43
36
|
// `nodeType: 1` means "Element".
|
|
44
37
|
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
@@ -48,7 +41,6 @@ export function forEach(node, tagName, func) {
|
|
|
48
41
|
} else {
|
|
49
42
|
func(childNode, i);
|
|
50
43
|
}
|
|
51
|
-
|
|
52
44
|
i++;
|
|
53
45
|
}
|
|
54
46
|
}
|
|
@@ -69,31 +61,27 @@ export function getTagName(element) {
|
|
|
69
61
|
// when getting `.tagName`, so just replacing anything
|
|
70
62
|
// before a colon, if any.
|
|
71
63
|
return element.tagName.replace(NAMESPACE_REG_EXP, '');
|
|
72
|
-
}
|
|
64
|
+
}
|
|
73
65
|
|
|
66
|
+
// This function is only used for occasional debug messages.
|
|
74
67
|
export function getOuterXml(node) {
|
|
75
68
|
// `nodeType: 1` means "Element".
|
|
76
69
|
// https://www.w3schools.com/xml/prop_element_nodetype.asp
|
|
77
70
|
if (node.nodeType !== 1) {
|
|
78
71
|
return node.textContent;
|
|
79
72
|
}
|
|
80
|
-
|
|
81
73
|
var xml = '<' + getTagName(node);
|
|
82
74
|
var j = 0;
|
|
83
|
-
|
|
84
75
|
while (j < node.attributes.length) {
|
|
85
76
|
xml += ' ' + node.attributes[j].name + '=' + '"' + node.attributes[j].value + '"';
|
|
86
77
|
j++;
|
|
87
78
|
}
|
|
88
|
-
|
|
89
79
|
xml += '>';
|
|
90
80
|
var i = 0;
|
|
91
|
-
|
|
92
81
|
while (i < node.childNodes.length) {
|
|
93
82
|
xml += getOuterXml(node.childNodes[i]);
|
|
94
83
|
i++;
|
|
95
84
|
}
|
|
96
|
-
|
|
97
85
|
xml += '</' + getTagName(node) + '>';
|
|
98
86
|
return xml;
|
|
99
87
|
}
|
package/modules/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":"AAAA,OAAO,SAASA,
|
|
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":"AAAA,OAAO,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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
1
|
-
import { findChild, findChildren, forEach, map, getTagName } from './dom.js';
|
|
2
|
-
// each element being an XML DOM element representing a cell.
|
|
1
|
+
import { findChild, findChildren, forEach, map, getTagName } from './dom.js';
|
|
3
2
|
|
|
3
|
+
// Returns an array of cells,
|
|
4
|
+
// each element being an XML DOM element representing a cell.
|
|
4
5
|
export function getCells(document) {
|
|
5
6
|
var worksheet = document.documentElement;
|
|
6
7
|
var sheetData = findChild(worksheet, 'sheetData');
|
|
@@ -16,13 +17,11 @@ export function getMergedCells(document) {
|
|
|
16
17
|
var worksheet = document.documentElement;
|
|
17
18
|
var mergedCells = findChild(worksheet, 'mergeCells');
|
|
18
19
|
var mergedCellsInfo = [];
|
|
19
|
-
|
|
20
20
|
if (mergedCells) {
|
|
21
21
|
forEach(mergedCells, 'mergeCell', function (mergedCell) {
|
|
22
22
|
mergedCellsInfo.push(mergedCell.getAttribute('ref'));
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
return mergedCellsInfo;
|
|
27
26
|
}
|
|
28
27
|
export function getCellValue(document, node) {
|
|
@@ -36,7 +35,6 @@ export function getCellInlineStringValue(document, node) {
|
|
|
36
35
|
export function getDimensions(document) {
|
|
37
36
|
var worksheet = document.documentElement;
|
|
38
37
|
var dimensions = findChild(worksheet, 'dimension');
|
|
39
|
-
|
|
40
38
|
if (dimensions) {
|
|
41
39
|
return dimensions.getAttribute('ref');
|
|
42
40
|
}
|
|
@@ -44,46 +42,39 @@ export function getDimensions(document) {
|
|
|
44
42
|
export function getBaseStyles(document) {
|
|
45
43
|
var styleSheet = document.documentElement;
|
|
46
44
|
var cellStyleXfs = findChild(styleSheet, 'cellStyleXfs');
|
|
47
|
-
|
|
48
45
|
if (cellStyleXfs) {
|
|
49
46
|
return findChildren(cellStyleXfs, 'xf');
|
|
50
47
|
}
|
|
51
|
-
|
|
52
48
|
return [];
|
|
53
49
|
}
|
|
54
50
|
export function getCellStyles(document) {
|
|
55
51
|
var styleSheet = document.documentElement;
|
|
56
52
|
var cellXfs = findChild(styleSheet, 'cellXfs');
|
|
57
|
-
|
|
58
53
|
if (!cellXfs) {
|
|
59
54
|
return [];
|
|
60
55
|
}
|
|
61
|
-
|
|
62
56
|
return findChildren(cellXfs, 'xf');
|
|
63
57
|
}
|
|
64
58
|
export function getNumberFormats(document) {
|
|
65
59
|
var styleSheet = document.documentElement;
|
|
66
60
|
var numberFormats = [];
|
|
67
61
|
var numFmts = findChild(styleSheet, 'numFmts');
|
|
68
|
-
|
|
69
62
|
if (numFmts) {
|
|
70
63
|
return findChildren(numFmts, 'numFmt');
|
|
71
64
|
}
|
|
72
|
-
|
|
73
65
|
return [];
|
|
74
66
|
}
|
|
75
67
|
export function getSharedStrings(document) {
|
|
76
68
|
// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` ("rich formatting") elements having `<t/>`.
|
|
77
69
|
// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1
|
|
78
70
|
// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html
|
|
71
|
+
|
|
79
72
|
var sst = document.documentElement;
|
|
80
73
|
return map(sst, 'si', function (string) {
|
|
81
74
|
var t = findChild(string, 't');
|
|
82
|
-
|
|
83
75
|
if (t) {
|
|
84
76
|
return t.textContent;
|
|
85
77
|
}
|
|
86
|
-
|
|
87
78
|
var value = '';
|
|
88
79
|
forEach(string, 'r', function (r) {
|
|
89
80
|
value += findChild(r, 't').textContent;
|
package/modules/xml/xlsx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xlsx.js","names":["findChild","findChildren","forEach","map","getTagName","getCells","document","worksheet","documentElement","sheetData","cells","row","cell","push","getMergedCells","mergedCells","mergedCellsInfo","mergedCell","getAttribute","getCellValue","node","getCellInlineStringValue","firstChild","textContent","getDimensions","dimensions","getBaseStyles","styleSheet","cellStyleXfs","getCellStyles","cellXfs","getNumberFormats","numberFormats","numFmts","getSharedStrings","sst","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,SAASA,
|
|
1
|
+
{"version":3,"file":"xlsx.js","names":["findChild","findChildren","forEach","map","getTagName","getCells","document","worksheet","documentElement","sheetData","cells","row","cell","push","getMergedCells","mergedCells","mergedCellsInfo","mergedCell","getAttribute","getCellValue","node","getCellInlineStringValue","firstChild","textContent","getDimensions","dimensions","getBaseStyles","styleSheet","cellStyleXfs","getCellStyles","cellXfs","getNumberFormats","numberFormats","numFmts","getSharedStrings","sst","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,SAASA,SAAS,EAAEC,YAAY,EAAEC,OAAO,EAAEC,GAAG,EAAEC,UAAU,QAAQ,UAAU;;AAE5E;AACA;AACA,OAAO,SAASC,QAAQA,CAACC,QAAQ,EAAE;EACjC,IAAMC,SAAS,GAAGD,QAAQ,CAACE,eAAe;EAC1C,IAAMC,SAAS,GAAGT,SAAS,CAACO,SAAS,EAAE,WAAW,CAAC;EAEnD,IAAMG,KAAK,GAAG,EAAE;EAChBR,OAAO,CAACO,SAAS,EAAE,KAAK,EAAE,UAACE,GAAG,EAAK;IACjCT,OAAO,CAACS,GAAG,EAAE,GAAG,EAAE,UAACC,IAAI,EAAK;MAC1BF,KAAK,CAACG,IAAI,CAACD,IAAI,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC,CAAC;EACF,OAAOF,KAAK;AACd;AAEA,OAAO,SAASI,cAAcA,CAACR,QAAQ,EAA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AE;EAC9C,IAAMmC,QAAQ,GAAGnC,QAAQ,CAACE,eAAe;EACzC,OAAOR,SAAS,CAACyC,QAAQ,EAAE,YAAY,CAAC;AAC1C;AAEA,OAAO,SAASC,gBAAgBA,CAACpC,QAAQ,EAAE;EACzC,IAAMqC,aAAa,GAAGrC,QAAQ,CAACE,eAAe;EAC9C,OAAOP,YAAY,CAAC0C,aAAa,EAAE,cAAc,CAAC;AACpD;AAEA,OAAO,SAASC,SAASA,CAACtC,QAAQ,EAAE;EAClC,IAAMmC,QAAQ,GAAGnC,QAAQ,CAACE,eAAe;EACzC,IAAMqC,MAAM,GAAG7C,SAAS,CAACyC,QAAQ,EAAE,QAAQ,CAAC;EAC5C,OAAOxC,YAAY,CAAC4C,MAAM,EAAE,OAAO,CAAC;AACtC"}
|
package/modules/xml/xml.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml.js","names":["DOMParser","createDocument","content","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,SAASA,
|
|
1
|
+
{"version":3,"file":"xml.js","names":["DOMParser","createDocument","content","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,SAASA,SAAS,QAAQ,gBAAgB;AAE1C,eAAe;EACdC,cAAc,WAAAA,eAACC,OAAO,EAAE;IACvB,OAAO,IAAIF,SAAS,CAAC,CAAC,CAACG,eAAe,CAACD,OAAO,CAAC;EAChD;AACD,CAAC"}
|
|
@@ -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":"AAAA,eAAe;EACdA,
|
|
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":"AAAA,eAAe;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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// This file is no longer used.
|
|
2
|
+
|
|
2
3
|
// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.
|
|
3
4
|
// https://github.com/catamphetamine/read-excel-file/issues/26
|
|
4
5
|
// The inclusion of `xpath` package in `./xpathNode`
|
|
@@ -31,7 +32,6 @@ export function getCellInlineStringValue(document, node) {
|
|
|
31
32
|
}
|
|
32
33
|
export function getDimensions(document) {
|
|
33
34
|
var dimensions = xpath(document, null, '/a:worksheet/a:dimension/@ref', namespaces)[0];
|
|
34
|
-
|
|
35
35
|
if (dimensions) {
|
|
36
36
|
return dimensions.textContent;
|
|
37
37
|
}
|
|
@@ -49,6 +49,7 @@ export function getSharedStrings(document) {
|
|
|
49
49
|
// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` ("rich formatting") elements having `<t/>`.
|
|
50
50
|
// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1
|
|
51
51
|
// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html
|
|
52
|
+
|
|
52
53
|
// The ".//a:t[not(ancestor::a:rPh)]" selector means:
|
|
53
54
|
// "select all `<t/>` that are not children of `<rPh/>`".
|
|
54
55
|
// https://stackoverflow.com/questions/42773772/xpath-span-what-does-the-dot-mean
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xlsx-xpath.js","names":["xpath","namespaces","a","r","rr","getCells","document","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":"AAAA
|
|
1
|
+
{"version":3,"file":"xlsx-xpath.js","names":["xpath","namespaces","a","r","rr","getCells","document","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":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,aAAa;AAE/B,IAAMC,UAAU,GAAG;EACjBC,CAAC,EAAE,2DAA2D;EAC9D;EACAC,CAAC,EAAE,qEAAqE;EACxE;EACAC,EAAE,EAAE;AACN,CAAC;AAED,OAAO,SAASC,QAAQA,CAACC,QAAQ,EAAE;EACjC,OAAON,KAAK,CAACM,QAAQ,EAAE,IAAI,EAAE,oCAAoC,EAAEL,UAAU,CAAC;AAChF;AAEA,OAAO,SAASM,cAAcA,CAACD,QAAQ,EAAE;EACvC,OAAON,KAAK,CAACM,QAAQ,EAAE,IAAI,EAAE,8CAA8C,EAAEL,UAAU,CAAC;AAC1F;AAEA,OAAO,SAASO,YAAYA,CAACF,QAAQ,EAAEG,IAAI,EAAE;EAC3C,OAAOT,KAAK,CAACM,QAAQ,EAAEG,IAAI,EAAE,OAAO,EAAER,UAAU,CAAC,CAAC,CAAC,CAAC;AACtD;AAEA,OAAO,SAASS,wBAAwBA,CAACJ,QAAQ,EAAEG,IAAI,EAAE;EACvD,OAAOT,KAAK,CAACM,QAAQ,EAAEG,IAAI,EAAE,YAAY,EAAER,UAAU,CAAC,CAAC,CAAC,CAAC,CAACU,WAAW;AACvE;AAEA,OAAO,SAASC,aAAaA,CAACN,QAAQ,EAAE;EACtC,IAAMO,UAAU,GAAGb,KAAK,CAACM,QAAQ,EAAE,IAAI,EAAE,+BAA+B,EAAEL,UAAU,CAAC,CAAC,CAAC,CAAC;EACxF,IAAIY,UAAU,EAAE;IACd,OAAOA,UAAU,CAACF,WAAW;EAC/B;AACF;AAEA,OAAO,SAASG,aAAaA,CAACR,QAAQ,EAAE;EACtC,OAAON,KAAK,CAACM,QAAQ,EAAE,IAAI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