@loaders.gl/xml 3.4.0-alpha.3 → 4.0.0-alpha.6
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/dist/dist.min.js +59 -57
- package/dist/es5/html-loader.js +6 -5
- package/dist/es5/html-loader.js.map +1 -1
- package/dist/es5/lib/parsers/parse-xml.js +22 -0
- package/dist/es5/lib/parsers/parse-xml.js.map +1 -1
- package/dist/es5/lib/parsers/streaming-xml-parser.js.map +1 -1
- package/dist/es5/lib/xml-utils/uncapitalize.js.map +1 -1
- package/dist/es5/sax-ts/sax.js.map +1 -1
- package/dist/es5/xml-loader.js +5 -32
- package/dist/es5/xml-loader.js.map +1 -1
- package/dist/esm/html-loader.js +6 -5
- package/dist/esm/html-loader.js.map +1 -1
- package/dist/esm/lib/parsers/parse-xml.js +20 -0
- package/dist/esm/lib/parsers/parse-xml.js.map +1 -1
- package/dist/esm/lib/parsers/streaming-xml-parser.js.map +1 -1
- package/dist/esm/lib/xml-utils/uncapitalize.js.map +1 -1
- package/dist/esm/sax-ts/sax.js.map +1 -1
- package/dist/esm/xml-loader.js +11 -33
- package/dist/esm/xml-loader.js.map +1 -1
- package/dist/html-loader.js +5 -5
- package/dist/lib/parsers/parse-xml.d.ts +16 -2
- package/dist/lib/parsers/parse-xml.d.ts.map +1 -1
- package/dist/lib/parsers/parse-xml.js +29 -1
- package/dist/xml-loader.d.ts +3 -38
- package/dist/xml-loader.d.ts.map +1 -1
- package/dist/xml-loader.js +7 -35
- package/package.json +4 -4
- package/src/html-loader.ts +5 -5
- package/src/lib/parsers/parse-xml.ts +53 -2
- package/src/xml-loader.ts +11 -60
package/dist/esm/html-loader.js
CHANGED
|
@@ -14,14 +14,15 @@ function testHTMLFile(text) {
|
|
|
14
14
|
return text.startsWith('<html');
|
|
15
15
|
}
|
|
16
16
|
function parseTextSync(text, options) {
|
|
17
|
+
var _XMLLoader$parseTextS;
|
|
17
18
|
options = mergeLoaderOptions(options, {
|
|
18
19
|
xml: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
_parser: 'fast-xml-parser',
|
|
21
|
+
_fastXML: {
|
|
22
|
+
htmlEntities: true
|
|
23
|
+
}
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
|
-
return XMLLoader.parseTextSync(text, options);
|
|
26
|
+
return (_XMLLoader$parseTextS = XMLLoader.parseTextSync) === null || _XMLLoader$parseTextS === void 0 ? void 0 : _XMLLoader$parseTextS.call(XMLLoader, text, options);
|
|
26
27
|
}
|
|
27
28
|
//# sourceMappingURL=html-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-loader.js","names":["mergeLoaderOptions","XMLLoader","HTMLLoader","name","id","extensions","mimeTypes","testText","testHTMLFile","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","text","startsWith","xml","
|
|
1
|
+
{"version":3,"file":"html-loader.js","names":["mergeLoaderOptions","XMLLoader","HTMLLoader","name","id","extensions","mimeTypes","testText","testHTMLFile","parse","arrayBuffer","options","parseTextSync","TextDecoder","decode","text","startsWith","_XMLLoader$parseTextS","xml","_parser","_fastXML","htmlEntities","call"],"sources":["../../src/html-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {mergeLoaderOptions} from '@loaders.gl/loader-utils';\nimport {XMLLoader, XMLLoaderOptions} from './xml-loader';\n\nexport type HTMLLoaderOptions = XMLLoaderOptions;\n\n/**\n * Loader for HTML files\n * Essentially a copy of the XMLLoader with different mime types, file extensions and content tests.\n * This split enables applications can control whether they want HTML responses to be parsed by the XML loader or not.\n * This loader does not have any additional understanding of the structure of HTML or the document.\n */\nexport const HTMLLoader: LoaderWithParser = {\n ...XMLLoader,\n name: 'HTML',\n id: 'html',\n extensions: ['html', 'htm'],\n mimeTypes: ['text/html'],\n testText: testHTMLFile,\n parse: async (arrayBuffer: ArrayBuffer, options?: XMLLoaderOptions) =>\n parseTextSync(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: (text: string, options?: XMLLoaderOptions) => parseTextSync(text, options)\n};\n\nfunction testHTMLFile(text: string): boolean {\n // TODO - There could be space first.\n return text.startsWith('<html');\n}\n\nfunction parseTextSync(text: string, options?: XMLLoaderOptions): any {\n // fast-xml-parser can recognize HTML entities\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#htmlentities\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/5.Entities.md\n options = mergeLoaderOptions(options, {\n xml: {\n _parser: 'fast-xml-parser',\n _fastXML: {\n htmlEntities: true\n }\n }\n });\n\n return XMLLoader.parseTextSync?.(text, options);\n}\n"],"mappings":"AAGA,SAAQA,kBAAkB,QAAO,0BAA0B;AAC3D,SAAQC,SAAS,QAAyB,cAAc;AAUxD,OAAO,MAAMC,UAA4B,GAAG;EAC1C,GAAGD,SAAS;EACZE,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,UAAU,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;EAC3BC,SAAS,EAAE,CAAC,WAAW,CAAC;EACxBC,QAAQ,EAAEC,YAAY;EACtBC,KAAK,EAAE,MAAAA,CAAOC,WAAwB,EAAEC,OAA0B,KAChEC,aAAa,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACJ,WAAW,CAAC,EAAEC,OAAO,CAAC;EAC/DC,aAAa,EAAEA,CAACG,IAAY,EAAEJ,OAA0B,KAAKC,aAAa,CAACG,IAAI,EAAEJ,OAAO;AAC1F,CAAC;AAED,SAASH,YAAYA,CAACO,IAAY,EAAW;EAE3C,OAAOA,IAAI,CAACC,UAAU,CAAC,OAAO,CAAC;AACjC;AAEA,SAASJ,aAAaA,CAACG,IAAY,EAAEJ,OAA0B,EAAO;EAAA,IAAAM,qBAAA;EAIpEN,OAAO,GAAGX,kBAAkB,CAACW,OAAO,EAAE;IACpCO,GAAG,EAAE;MACHC,OAAO,EAAE,iBAAiB;MAC1BC,QAAQ,EAAE;QACRC,YAAY,EAAE;MAChB;IACF;EACF,CAAC,CAAC;EAEF,QAAAJ,qBAAA,GAAOhB,SAAS,CAACW,aAAa,cAAAK,qBAAA,uBAAvBA,qBAAA,CAAAK,IAAA,CAAArB,SAAS,EAAiBc,IAAI,EAAEJ,OAAO,CAAC;AACjD"}
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { StreamingXMLParser } from './streaming-xml-parser';
|
|
2
|
+
import { uncapitalizeKeys } from '../xml-utils/uncapitalize';
|
|
2
3
|
import { XMLParser as FastXMLParser } from 'fast-xml-parser';
|
|
4
|
+
export function parseXMLSync(text, options) {
|
|
5
|
+
if (options !== null && options !== void 0 && options._parser && options._parser !== 'fast-xml-parser') {
|
|
6
|
+
throw new Error(options === null || options === void 0 ? void 0 : options._parser);
|
|
7
|
+
}
|
|
8
|
+
const fastXMLOptions = {
|
|
9
|
+
allowBooleanAttributes: true,
|
|
10
|
+
ignoreDeclaration: true,
|
|
11
|
+
removeNSPrefix: options === null || options === void 0 ? void 0 : options.removeNSPrefix,
|
|
12
|
+
textNodeName: options === null || options === void 0 ? void 0 : options.textNodeName,
|
|
13
|
+
isArray: (name, jpath, isLeafNode, isAttribute) => {
|
|
14
|
+
var _options$arrayPaths;
|
|
15
|
+
const array = Boolean(options === null || options === void 0 ? void 0 : (_options$arrayPaths = options.arrayPaths) === null || _options$arrayPaths === void 0 ? void 0 : _options$arrayPaths.some(path => jpath === path));
|
|
16
|
+
return array;
|
|
17
|
+
},
|
|
18
|
+
...(options === null || options === void 0 ? void 0 : options._fastXML)
|
|
19
|
+
};
|
|
20
|
+
const xml = fastParseXML(text, fastXMLOptions);
|
|
21
|
+
return options !== null && options !== void 0 && options.uncapitalizeKeys ? uncapitalizeKeys(xml) : xml;
|
|
22
|
+
}
|
|
3
23
|
export function fastParseXML(text, options) {
|
|
4
24
|
const parser = new FastXMLParser({
|
|
5
25
|
ignoreAttributes: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-xml.js","names":["StreamingXMLParser","XMLParser","FastXMLParser","
|
|
1
|
+
{"version":3,"file":"parse-xml.js","names":["StreamingXMLParser","uncapitalizeKeys","XMLParser","FastXMLParser","parseXMLSync","text","options","_parser","Error","fastXMLOptions","allowBooleanAttributes","ignoreDeclaration","removeNSPrefix","textNodeName","isArray","name","jpath","isLeafNode","isAttribute","_options$arrayPaths","array","Boolean","arrayPaths","some","path","_fastXML","xml","fastParseXML","parser","ignoreAttributes","attributeNamePrefix","parsedXML","parse","parseXMLInBatches","arguments","length","undefined","strict","write","close","result"],"sources":["../../../../src/lib/parsers/parse-xml.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {SAXParserOptions} from '../../sax-ts/sax';\nimport {StreamingXMLParser} from './streaming-xml-parser';\nimport {uncapitalizeKeys} from '../xml-utils/uncapitalize';\nimport {XMLParser as FastXMLParser} from 'fast-xml-parser';\nimport type {X2jOptions} from 'fast-xml-parser';\n\nexport type ParseXMLOptions = {\n /** XML is typically PascalCase, JavaScript prefects camelCase */\n uncapitalizeKeys?: boolean;\n removeNSPrefix?: boolean;\n textNodeName?: string;\n arrayPaths?: string[];\n\n // NOTE: Only fast-xml-parser is implemented\n _parser?: 'fast-xml-parser' | 'sax';\n /** @deprecated Experimental, passes options to fast-xml-parser, IF it is being used */\n _fastXML?: _FastParseXMLOptions;\n /** @deprecated Experimental, passes options to the SAX XML parser, IF it is being used. */\n _sax?: SAXParserOptions;\n};\n\n/** Type for passing through fast-xml-parser options */\nexport type _FastParseXMLOptions = Partial<X2jOptions>;\n\nexport function parseXMLSync(text: string, options?: ParseXMLOptions): any {\n if (options?._parser && options._parser !== 'fast-xml-parser') {\n throw new Error(options?._parser);\n }\n\n const fastXMLOptions: _FastParseXMLOptions = {\n // Default FastXML options\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#allowbooleanattributes\n allowBooleanAttributes: true,\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#ignoredeclaration\n ignoreDeclaration: true,\n\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#removensprefix\n removeNSPrefix: options?.removeNSPrefix,\n\n // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#textnodename\n textNodeName: options?.textNodeName,\n\n // Let's application specify keys that are always arrays\n isArray: (name: string, jpath: string, isLeafNode: boolean, isAttribute: boolean) => {\n const array = Boolean(options?.arrayPaths?.some((path) => jpath === path));\n return array;\n },\n\n // Application overrides\n ...options?._fastXML\n };\n\n const xml = fastParseXML(text, fastXMLOptions);\n\n // Note - could be done with FastXML tag processing\n return options?.uncapitalizeKeys ? uncapitalizeKeys(xml) : xml;\n}\n\nexport function fastParseXML(text: string, options: _FastParseXMLOptions): any {\n const parser = new FastXMLParser({\n ignoreAttributes: false,\n attributeNamePrefix: '',\n ...options\n });\n\n const parsedXML = parser.parse(text);\n\n return parsedXML;\n}\n\n/**\n * @todo Build a streaming XML parser based on sax-js\n * @param text\n * @param options\n * @returns\n */\nexport function parseXMLInBatches(text: string, options = {}): any {\n const parser = new StreamingXMLParser({\n ...options,\n strict: true\n });\n\n parser.write(text);\n parser.close();\n\n return parser.result;\n}\n"],"mappings":"AAGA,SAAQA,kBAAkB,QAAO,wBAAwB;AACzD,SAAQC,gBAAgB,QAAO,2BAA2B;AAC1D,SAAQC,SAAS,IAAIC,aAAa,QAAO,iBAAiB;AAqB1D,OAAO,SAASC,YAAYA,CAACC,IAAY,EAAEC,OAAyB,EAAO;EACzE,IAAIA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,OAAO,IAAID,OAAO,CAACC,OAAO,KAAK,iBAAiB,EAAE;IAC7D,MAAM,IAAIC,KAAK,CAACF,OAAO,aAAPA,OAAO,uBAAPA,OA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,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC1D,MAAMN,MAAM,GAAG,IAAI5B,kBAAkB,CAAC;IACpC,GAAGM,OAAO;IACV+B,MAAM,EAAE;EACV,CAAC,CAAC;EAEFT,MAAM,CAACU,KAAK,CAACjC,IAAI,CAAC;EAClBuB,MAAM,CAACW,KAAK,CAAC,CAAC;EAEd,OAAOX,MAAM,CAACY,MAAM;AACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-xml-parser.js","names":["SAXParser","StreamingXMLParser","constructor","options","_defineProperty","undefined","Object","freeze","container","key","reset","parser","onready","previousStates","length","currentState","onopentag","_ref","name","attributes","isSelfClosing","_openObject","emit","onkey","onclosetag","_closeObject","onopenarray","_openArray","onclosearray","_closeArray","ontext","value","_pushOrSet","onerror","error","onend","result","pop","write","chunk","close","Array","isArray","push","newContainer","arguments"],"sources":["../../../../src/lib/parsers/streaming-xml-parser.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable */\n\nimport {SAXParser, SAXParserOptions} from '../../sax-ts/sax';\n// import JSONPath from '../jsonpath/jsonpath';\n\nexport type StreamingXMLParserOptions = SAXParserOptions;\n\n/**\n * StreamingXMLParser builds a JSON object using the events emitted by the SAX parser\n */\nexport class StreamingXMLParser {\n readonly parser: SAXParser;\n result = undefined;\n previousStates = [];\n currentState = Object.freeze({container: [], key: null});\n // jsonpath: JSONPath = new JSONPath();\n\n constructor(options: SAXParserOptions) {\n this.reset();\n this.parser = new SAXParser({\n onready: () => {\n this.previousStates.length = 0;\n this.currentState.container.length = 0;\n },\n\n onopentag: ({name, attributes, isSelfClosing}) => {\n this._openObject({});\n if (typeof name !== 'undefined') {\n this.parser.emit('onkey', name);\n }\n },\n\n onkey: (name) => {\n this.currentState.key = name;\n },\n\n onclosetag: () => {\n this._closeObject();\n },\n\n onopenarray: () => {\n this._openArray();\n },\n\n onclosearray: () => {\n this._closeArray();\n },\n\n ontext: (value) => {\n this._pushOrSet(value);\n },\n\n onerror: (error) => {\n throw error;\n },\n\n onend: () => {\n this.result = this.currentState.container.pop();\n },\n\n ...options\n });\n }\n\n reset(): void {\n this.result = undefined;\n this.previousStates = [];\n this.currentState = Object.freeze({container: [], key: null});\n }\n\n write(chunk): void {\n this.parser.write(chunk);\n }\n\n close(): void {\n this.parser.close();\n }\n\n // PRIVATE METHODS\n\n _pushOrSet(value): void {\n const {container, key} = this.currentState;\n if (key !== null) {\n container[key] = value;\n this.currentState.key = null;\n } else if (Array.isArray(container)) {\n container.push(value);\n } else if (container) {\n // debugger\n }\n }\n\n _openArray(newContainer = []): void {\n // this.jsonpath.push(null);\n this._pushOrSet(newContainer);\n this.previousStates.push(this.currentState);\n this.currentState = {container: newContainer, isArray: true, key: null};\n }\n\n _closeArray(): void {\n // this.jsonpath.pop();\n this.currentState = this.previousStates.pop();\n }\n\n _openObject(newContainer = {}): void {\n // this.jsonpath.push(null);\n this._pushOrSet(newContainer);\n this.previousStates.push(this.currentState);\n this.currentState = {container: newContainer, isArray: false, key: null};\n }\n\n _closeObject(): void {\n // this.jsonpath.pop();\n this.currentState = this.previousStates.pop();\n }\n}\n"],"mappings":";AAGA,SAAQA,SAAS,QAAyB,kBAAkB;AAQ5D,OAAO,MAAMC,kBAAkB,CAAC;EAO9BC,WAAWA,CAACC,OAAyB,EAAE;IAAAC,eAAA;IAAAA,eAAA,iBAL9BC,SAAS;IAAAD,eAAA,yBACD,EAAE;IAAAA,eAAA,uBACJE,MAAM,CAACC,MAAM,CAAC;MAACC,SAAS,EAAE,EAAE;MAAEC,GAAG,EAAE;IAAI,CAAC,CAAC;IAItD,IAAI,CAACC,KAAK,
|
|
1
|
+
{"version":3,"file":"streaming-xml-parser.js","names":["SAXParser","StreamingXMLParser","constructor","options","_defineProperty","undefined","Object","freeze","container","key","reset","parser","onready","previousStates","length","currentState","onopentag","_ref","name","attributes","isSelfClosing","_openObject","emit","onkey","onclosetag","_closeObject","onopenarray","_openArray","onclosearray","_closeArray","ontext","value","_pushOrSet","onerror","error","onend","result","pop","write","chunk","close","Array","isArray","push","newContainer","arguments"],"sources":["../../../../src/lib/parsers/streaming-xml-parser.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable */\n\nimport {SAXParser, SAXParserOptions} from '../../sax-ts/sax';\n// import JSONPath from '../jsonpath/jsonpath';\n\nexport type StreamingXMLParserOptions = SAXParserOptions;\n\n/**\n * StreamingXMLParser builds a JSON object using the events emitted by the SAX parser\n */\nexport class StreamingXMLParser {\n readonly parser: SAXParser;\n result = undefined;\n previousStates = [];\n currentState = Object.freeze({container: [], key: null});\n // jsonpath: JSONPath = new JSONPath();\n\n constructor(options: SAXParserOptions) {\n this.reset();\n this.parser = new SAXParser({\n onready: () => {\n this.previousStates.length = 0;\n this.currentState.container.length = 0;\n },\n\n onopentag: ({name, attributes, isSelfClosing}) => {\n this._openObject({});\n if (typeof name !== 'undefined') {\n this.parser.emit('onkey', name);\n }\n },\n\n onkey: (name) => {\n this.currentState.key = name;\n },\n\n onclosetag: () => {\n this._closeObject();\n },\n\n onopenarray: () => {\n this._openArray();\n },\n\n onclosearray: () => {\n this._closeArray();\n },\n\n ontext: (value) => {\n this._pushOrSet(value);\n },\n\n onerror: (error) => {\n throw error;\n },\n\n onend: () => {\n this.result = this.currentState.container.pop();\n },\n\n ...options\n });\n }\n\n reset(): void {\n this.result = undefined;\n this.previousStates = [];\n this.currentState = Object.freeze({container: [], key: null});\n }\n\n write(chunk): void {\n this.parser.write(chunk);\n }\n\n close(): void {\n this.parser.close();\n }\n\n // PRIVATE METHODS\n\n _pushOrSet(value): void {\n const {container, key} = this.currentState;\n if (key !== null) {\n container[key] = value;\n this.currentState.key = null;\n } else if (Array.isArray(container)) {\n container.push(value);\n } else if (container) {\n // debugger\n }\n }\n\n _openArray(newContainer = []): void {\n // this.jsonpath.push(null);\n this._pushOrSet(newContainer);\n this.previousStates.push(this.currentState);\n this.currentState = {container: newContainer, isArray: true, key: null};\n }\n\n _closeArray(): void {\n // this.jsonpath.pop();\n this.currentState = this.previousStates.pop();\n }\n\n _openObject(newContainer = {}): void {\n // this.jsonpath.push(null);\n this._pushOrSet(newContainer);\n this.previousStates.push(this.currentState);\n this.currentState = {container: newContainer, isArray: false, key: null};\n }\n\n _closeObject(): void {\n // this.jsonpath.pop();\n this.currentState = this.previousStates.pop();\n }\n}\n"],"mappings":";AAGA,SAAQA,SAAS,QAAyB,kBAAkB;AAQ5D,OAAO,MAAMC,kBAAkB,CAAC;EAO9BC,WAAWA,CAACC,OAAyB,EAAE;IAAAC,eAAA;IAAAA,eAAA,iBAL9BC,SAAS;IAAAD,eAAA,yBACD,EAAE;IAAAA,eAAA,uBACJE,MAAM,CAACC,MAAM,CAAC;MAACC,SAAS,EAAE,EAAE;MAAEC,GAAG,EAAE;IAAI,CAAC,CAAC;IAItD,IAAI,CAACC,KAAK,CAAC,CAAC;IACZ,IAAI,CAACC,MAAM,GAAG,IAAIX,SAAS,CAAC;MAC1BY,OAAO,EAAEA,CAAA,KAAM;QACb,IAAI,CAACC,cAAc,CAACC,MAAM,GAAG,CAAC;QAC9B,IAAI,CAACC,YAAY,CAACP,SAAS,CAACM,MAAM,GAAG,CAAC;MACxC,CAAC;MAEDE,SAAS,EAAEC,IAAA,IAAuC;QAAA,IAAtC;UAACC,IAAI;UAAEC,UAAU;UAAEC;QAAa,CAAC,GAAAH,IAAA;QAC3C,IAAI,CAACI,WAAW,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,OAAOH,IAAI,KAAK,WAAW,EAAE;UAC/B,IAAI,CAACP,MAAM,CAACW,IAAI,CAAC,OAAO,EAAEJ,IAAI,CAAC;QACjC;MACF,CAAC;MAEDK,KAAK,EAAGL,IAAI,IAAK;QACf,IAAI,CAACH,YAAY,CAACN,GAAG,GAAGS,IAAI;MAC9B,CAAC;MAEDM,UAAU,EAAEA,CAAA,KAAM;QAChB,IAAI,CAACC,YAAY,CAAC,CAAC;MACrB,CAAC;MAEDC,WAAW,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IACvB,CAAC,MAAM,IAAIvB,SAAS,EAAE,CAEtB;EACF;EAEAmB,UAAUA,CAAA,EAA0B;IAAA,IAAzBiB,YAAY,GAAAC,SAAA,CAAA/B,MAAA,QAAA+B,SAAA,QAAAxC,SAAA,GAAAwC,SAAA,MAAG,EAAE;IAE1B,IAAI,CAACb,UAAU,CAACY,YAAY,CAAC;IAC7B,IAAI,CAAC/B,cAAc,CAAC8B,IAAI,CAAC,IAAI,CAAC5B,YAAY,CAAC;IAC3C,IAAI,CAACA,YAAY,GAAG;MAACP,SAAS,EAAEoC,YAAY;MAAEF,OAAO,EAAE,IAAI;MAAEjC,GAAG,EAAE;IAAI,CAAC;EACzE;EAEAoB,WAAWA,CAAA,EAAS;IAElB,IAAI,CAACd,YAAY,GAAG,IAAI,CAACF,cAAc,CAACwB,GAAG,CAAC,CAAC;EAC/C;EAEAhB,WAAWA,CAAA,EAA0B;IAAA,IAAzBuB,YAAY,GAAAC,SAAA,CAAA/B,MAAA,QAAA+B,SAAA,QAAAxC,SAAA,GAAAwC,SAAA,MAAG,CAAC,CAAC;IAE3B,IAAI,CAACb,UAAU,CAACY,YAAY,CAAC;IAC7B,IAAI,CAAC/B,cAAc,CAAC8B,IAAI,CAAC,IAAI,CAAC5B,YAAY,CAAC;IAC3C,IAAI,CAACA,YAAY,GAAG;MAACP,SAAS,EAAEoC,YAAY;MAAEF,OAAO,EAAE,KAAK;MAAEjC,GAAG,EAAE;IAAI,CAAC;EAC1E;EAEAgB,YAAYA,CAAA,EAAS;IAEnB,IAAI,CAACV,YAAY,GAAG,IAAI,CAACF,cAAc,CAACwB,GAAG,CAAC,CAAC;EAC/C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uncapitalize.js","names":["uncapitalize","str","charAt","toLowerCase","slice","uncapitalizeKeys","object","Array","isArray","map","element","newObject","key","value","Object","entries"],"sources":["../../../../src/lib/xml-utils/uncapitalize.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/**\n * Uncapitalize first letter of a string\n * @param str\n * @returns\n */\nexport function uncapitalize(str: string): string {\n return typeof str === 'string' ? str.charAt(0).toLowerCase() + str.slice(1) : str;\n}\n\n/**\n * Recursively uncapitalize all keys in a nested object\n * @param object\n * @returns\n */\nexport function uncapitalizeKeys(object: any): any {\n if (Array.isArray(object)) {\n return object.map((element) => uncapitalizeKeys(element));\n }\n\n if (object && typeof object === 'object') {\n const newObject = {};\n for (const [key, value] of Object.entries(object)) {\n newObject[uncapitalize(key)] = uncapitalizeKeys(value);\n }\n return newObject;\n }\n\n return object;\n}\n"],"mappings":"AAOA,OAAO,SAASA,YAAYA,CAACC,GAAW,EAAU;EAChD,OAAO,OAAOA,GAAG,KAAK,QAAQ,GAAGA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,
|
|
1
|
+
{"version":3,"file":"uncapitalize.js","names":["uncapitalize","str","charAt","toLowerCase","slice","uncapitalizeKeys","object","Array","isArray","map","element","newObject","key","value","Object","entries"],"sources":["../../../../src/lib/xml-utils/uncapitalize.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/**\n * Uncapitalize first letter of a string\n * @param str\n * @returns\n */\nexport function uncapitalize(str: string): string {\n return typeof str === 'string' ? str.charAt(0).toLowerCase() + str.slice(1) : str;\n}\n\n/**\n * Recursively uncapitalize all keys in a nested object\n * @param object\n * @returns\n */\nexport function uncapitalizeKeys(object: any): any {\n if (Array.isArray(object)) {\n return object.map((element) => uncapitalizeKeys(element));\n }\n\n if (object && typeof object === 'object') {\n const newObject = {};\n for (const [key, value] of Object.entries(object)) {\n newObject[uncapitalize(key)] = uncapitalizeKeys(value);\n }\n return newObject;\n }\n\n return object;\n}\n"],"mappings":"AAOA,OAAO,SAASA,YAAYA,CAACC,GAAW,EAAU;EAChD,OAAO,OAAOA,GAAG,KAAK,QAAQ,GAAGA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGF,GAAG,CAACG,KAAK,CAAC,CAAC,CAAC,GAAGH,GAAG;AACnF;AAOA,OAAO,SAASI,gBAAgBA,CAACC,MAAW,EAAO;EACjD,IAAIC,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;IACzB,OAAOA,MAAM,CAACG,GAAG,CAAEC,OAAO,IAAKL,gBAAgB,CAACK,OAAO,CAAC,CAAC;EAC3D;EAEA,IAAIJ,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IACxC,MAAMK,SAAS,GAAG,CAAC,CAAC;IACpB,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACT,MAAM,CAAC,EAAE;MACjDK,SAAS,CAACX,YAAY,CAACY,GAAG,CAAC,CAAC,GAAGP,gBAAgB,CAACQ,KAAK,CAAC;IACxD;IACA,OAAOF,SAAS;EAClB;EAEA,OAAOL,MAAM;AACf"}
|