@loaders.gl/json 4.4.0-alpha.2 → 4.4.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/dist.dev.js +260 -24
  2. package/dist/dist.min.js +11 -11
  3. package/dist/geojson-loader.d.ts.map +1 -1
  4. package/dist/geojson-loader.js +4 -2
  5. package/dist/geojson-loader.js.map +1 -0
  6. package/dist/geojson-worker.js +239 -22
  7. package/dist/geojson-writer.js +1 -0
  8. package/dist/geojson-writer.js.map +1 -0
  9. package/dist/index.cjs +222 -30
  10. package/dist/index.cjs.map +4 -4
  11. package/dist/index.js +1 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/json-loader.js +2 -1
  14. package/dist/json-loader.js.map +1 -0
  15. package/dist/json-writer.js +1 -0
  16. package/dist/json-writer.js.map +1 -0
  17. package/dist/lib/clarinet/clarinet.js +1 -0
  18. package/dist/lib/clarinet/clarinet.js.map +1 -0
  19. package/dist/lib/encoder-utils/encode-table-row.js +1 -0
  20. package/dist/lib/encoder-utils/encode-table-row.js.map +1 -0
  21. package/dist/lib/encoder-utils/encode-utils.js +1 -0
  22. package/dist/lib/encoder-utils/encode-utils.js.map +1 -0
  23. package/dist/lib/encoder-utils/utf8-encoder.d.ts +1 -1
  24. package/dist/lib/encoder-utils/utf8-encoder.d.ts.map +1 -1
  25. package/dist/lib/encoder-utils/utf8-encoder.js +3 -1
  26. package/dist/lib/encoder-utils/utf8-encoder.js.map +1 -0
  27. package/dist/lib/encoders/geojson-encoder.js +1 -0
  28. package/dist/lib/encoders/geojson-encoder.js.map +1 -0
  29. package/dist/lib/encoders/json-encoder.js +1 -0
  30. package/dist/lib/encoders/json-encoder.js.map +1 -0
  31. package/dist/lib/json-parser/json-parser.js +1 -0
  32. package/dist/lib/json-parser/json-parser.js.map +1 -0
  33. package/dist/lib/json-parser/streaming-json-parser.js +1 -0
  34. package/dist/lib/json-parser/streaming-json-parser.js.map +1 -0
  35. package/dist/lib/jsonpath/jsonpath.d.ts.map +1 -1
  36. package/dist/lib/jsonpath/jsonpath.js +213 -18
  37. package/dist/lib/jsonpath/jsonpath.js.map +1 -0
  38. package/dist/lib/parsers/parse-json-in-batches.d.ts +1 -1
  39. package/dist/lib/parsers/parse-json-in-batches.d.ts.map +1 -1
  40. package/dist/lib/parsers/parse-json-in-batches.js +5 -4
  41. package/dist/lib/parsers/parse-json-in-batches.js.map +1 -0
  42. package/dist/lib/parsers/parse-json.js +1 -0
  43. package/dist/lib/parsers/parse-json.js.map +1 -0
  44. package/dist/lib/parsers/parse-ndjson-in-batches.d.ts +1 -1
  45. package/dist/lib/parsers/parse-ndjson-in-batches.d.ts.map +1 -1
  46. package/dist/lib/parsers/parse-ndjson-in-batches.js +4 -3
  47. package/dist/lib/parsers/parse-ndjson-in-batches.js.map +1 -0
  48. package/dist/lib/parsers/parse-ndjson.js +1 -0
  49. package/dist/lib/parsers/parse-ndjson.js.map +1 -0
  50. package/dist/ndgeoson-loader.js +2 -1
  51. package/dist/ndgeoson-loader.js.map +1 -0
  52. package/dist/ndjson-loader.js +2 -1
  53. package/dist/ndjson-loader.js.map +1 -0
  54. package/dist/workers/geojson-worker.js +1 -0
  55. package/dist/workers/geojson-worker.js.map +1 -0
  56. package/package.json +9 -6
  57. package/src/geojson-loader.ts +2 -1
  58. package/src/json-loader.ts +3 -1
  59. package/src/lib/encoder-utils/utf8-encoder.ts +4 -2
  60. package/src/lib/jsonpath/jsonpath.ts +268 -21
  61. package/src/lib/parsers/parse-json-in-batches.ts +7 -5
  62. package/src/lib/parsers/parse-ndjson-in-batches.ts +7 -4
@@ -1 +1 @@
1
- {"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,uBAAuB,EAAE,YAAY,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1F,OAAO,KAAK,EAAC,iBAAiB,EAA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X,UAAU;;;;;;;;;;;;;;;;;;;;;;CAuBiC,CAAC;AAE5E,eAAO,MAAM,aAAa;;;;uBA1BK,YAAY;wBACX,UAAU;;;;;;;;;;;;;;;;;;;;;;CAgC2C,CAAC;AAEtF,iBAAe,KAAK,CAClB,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,YAAY,GAAG,uBAAuB,CAAC,CAEjD;AAED,iBAAS,aAAa,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,oBAAoB,GAC7B,YAAY,GAAG,uBAAuB,CA2BxC;AAED,iBAAS,cAAc,CAAC,aAAa,KAAA,EAAE,OAAO,KAAA,GAAG,aAAa,CAAC,UAAU,CAAC,CAczE"}
@@ -6,7 +6,7 @@ import { geojsonToBinary } from '@loaders.gl/gis';
6
6
  import { parseJSONInBatches } from "./lib/parsers/parse-json-in-batches.js";
7
7
  // __VERSION__ is injected by babel-plugin-version-inline
8
8
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
9
- const VERSION = typeof "4.4.0-alpha.1" !== 'undefined' ? "4.4.0-alpha.1" : 'latest';
9
+ const VERSION = typeof "4.4.0-alpha.9" !== 'undefined' ? "4.4.0-alpha.9" : 'latest';
10
10
  /**
11
11
  * GeoJSON loader
12
12
  */
@@ -75,7 +75,8 @@ function parseTextSync(text, options) {
75
75
  function parseInBatches(asyncIterator, options) {
76
76
  // Apps can call the parse method directly, we so apply default options here
77
77
  options = { ...GeoJSONLoader.options, ...options };
78
- options.json = { ...GeoJSONLoader.options.geojson, ...options.geojson };
78
+ options.json = { ...GeoJSONLoader.options.json, ...options.json };
79
+ options.geojson = { ...GeoJSONLoader.options.geojson, ...options.geojson };
79
80
  const geojsonIterator = parseJSONInBatches(asyncIterator, options);
80
81
  switch (options.gis.format) {
81
82
  case 'binary':
@@ -90,3 +91,4 @@ async function* makeBinaryGeometryIterator(geojsonIterator) {
90
91
  yield batch;
91
92
  }
92
93
  }
94
+ //# sourceMappingURL=geojson-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geojson-loader.js","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAKpC,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,0DAA0D;AAC1D,OAAO,EAAC,kBAAkB,EAAC,+CAA4C;AAEvE,yDAAyD;AACzD,qDAAqD;AACrD,MAAM,OAAO,GAAG,sBAAkB,KAAK,WAAW,CAAC,CAAC,iBAAa,CAAC,CAAC,QAAQ,CAAC;AAW5E;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ,EAAE,IAA+B;IACzC,SAAS,EAAE,IAA6B;IAExC,IAAI,EAAE,SAAS;IACf,EAAE,EAAE,SAAS;IACb,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,sBAAsB,CAAC;IACnC,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,IAAI;IACV,OAAO,EAAE;QACP,OAAO,EAAE;YACP,KAAK,EAAE,eAAe;SACvB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,kBAAkB;YACzB,SAAS,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC;SAC/B;QACD,GAAG,EAAE;YACH,MAAM,EAAE,SAAS;SAClB;KACF;CACwE,CAAC;AAE5E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,mBAAmB;IACtB,mBAAmB;IACnB,KAAK;IACL,mBAAmB;IACnB,aAAa;IACb,cAAc;CACqE,CAAC;AAEtF,KAAK,UAAU,KAAK,CAClB,WAAwB,EACxB,OAA8B;IAE9B,OAAO,aAAa,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,CA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E,MAAM,eAAe,GAAG,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAEnE,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QAC3B,KAAK,QAAQ;YACX,OAAO,0BAA0B,CAAC,eAAe,CAAC,CAAC;QACrD;YACE,OAAO,eAA4C,CAAC;IACxD,CAAC;AACH,CAAC;AAED,KAAK,SAAS,CAAC,CAAC,0BAA0B,CAAC,eAAe;IACxD,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,eAAe,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -205,7 +205,10 @@
205
205
  options = {
206
206
  ...options,
207
207
  modules: loader && loader.options && loader.options.modules || {},
208
- worker: false
208
+ core: {
209
+ ...options.core,
210
+ worker: false
211
+ }
209
212
  };
210
213
  return await parser(data, { ...options }, context, loader);
211
214
  }
@@ -218,6 +221,29 @@
218
221
  }
219
222
  }
220
223
 
224
+ // ../loader-utils/src/lib/iterators/async-iteration.ts
225
+ async function* toArrayBufferIterator(asyncIterator) {
226
+ for await (const chunk of asyncIterator) {
227
+ yield copyToArrayBuffer(chunk);
228
+ }
229
+ }
230
+ function copyToArrayBuffer(chunk) {
231
+ if (chunk instanceof ArrayBuffer) {
232
+ return chunk;
233
+ }
234
+ if (ArrayBuffer.isView(chunk)) {
235
+ const { buffer, byteOffset, byteLength } = chunk;
236
+ return copyFromBuffer(buffer, byteOffset, byteLength);
237
+ }
238
+ return copyFromBuffer(chunk);
239
+ }
240
+ function copyFromBuffer(buffer, byteOffset = 0, byteLength = buffer.byteLength - byteOffset) {
241
+ const view = new Uint8Array(buffer, byteOffset, byteLength);
242
+ const copy2 = new Uint8Array(view.length);
243
+ copy2.set(view);
244
+ return copy2.buffer;
245
+ }
246
+
221
247
  // ../gis/src/lib/geometry-api/geometry-info.ts
222
248
  function getGeometryInfo(features) {
223
249
  let pointPositionsCount = 0;
@@ -13909,27 +13935,13 @@ Char: ${this.c}`;
13909
13935
  var JSONPath = class {
13910
13936
  path;
13911
13937
  constructor(path = null) {
13912
- this.path = ["$"];
13913
- if (path instanceof JSONPath) {
13914
- this.path = [...path.path];
13915
- return;
13916
- }
13917
- if (Array.isArray(path)) {
13918
- this.path.push(...path);
13919
- return;
13920
- }
13921
- if (typeof path === "string") {
13922
- this.path = path.split(".");
13923
- if (this.path[0] !== "$") {
13924
- throw new Error("JSONPaths must start with $");
13925
- }
13926
- }
13938
+ this.path = parseJsonPath(path);
13927
13939
  }
13928
13940
  clone() {
13929
13941
  return new JSONPath(this);
13930
13942
  }
13931
13943
  toString() {
13932
- return this.path.join(".");
13944
+ return formatJsonPath(this.path);
13933
13945
  }
13934
13946
  push(name) {
13935
13947
  this.path.push(name);
@@ -13981,6 +13993,210 @@ Char: ${this.c}`;
13981
13993
  return object[field];
13982
13994
  }
13983
13995
  };
13996
+ function parseJsonPath(path) {
13997
+ if (path instanceof JSONPath) {
13998
+ return [...path.path];
13999
+ }
14000
+ if (Array.isArray(path)) {
14001
+ return ["$"].concat(path);
14002
+ }
14003
+ if (typeof path === "string") {
14004
+ return parseJsonPathString(path);
14005
+ }
14006
+ return ["$"];
14007
+ }
14008
+ function parseJsonPathString(pathString) {
14009
+ const trimmedPath = pathString.trim();
14010
+ if (!trimmedPath.startsWith("$")) {
14011
+ throw new Error("JSONPath must start with $");
14012
+ }
14013
+ const segments = ["$"];
14014
+ let index = 1;
14015
+ let arrayElementSelectorEncountered = false;
14016
+ while (index < trimmedPath.length) {
14017
+ const character = trimmedPath[index];
14018
+ if (character === ".") {
14019
+ if (arrayElementSelectorEncountered) {
14020
+ throw new Error("JSONPath cannot select fields after array element selectors");
14021
+ }
14022
+ index += 1;
14023
+ if (trimmedPath[index] === ".") {
14024
+ throw new Error("JSONPath descendant selectors (..) are not supported");
14025
+ }
14026
+ const { value, nextIndex, isWildcard } = parseDotSegment(trimmedPath, index);
14027
+ if (isWildcard) {
14028
+ if (nextIndex < trimmedPath.length) {
14029
+ throw new Error("JSONPath wildcard selectors must terminate the path");
14030
+ }
14031
+ arrayElementSelectorEncountered = true;
14032
+ index = nextIndex;
14033
+ continue;
14034
+ }
14035
+ segments.push(value);
14036
+ index = nextIndex;
14037
+ continue;
14038
+ }
14039
+ if (character === "[") {
14040
+ const parsedSegment = parseBracketSegment(trimmedPath, index);
14041
+ if (parsedSegment.type === "property") {
14042
+ if (arrayElementSelectorEncountered) {
14043
+ throw new Error("JSONPath cannot select fields after array element selectors");
14044
+ }
14045
+ segments.push(parsedSegment.value);
14046
+ } else {
14047
+ arrayElementSelectorEncountered = true;
14048
+ }
14049
+ index = parsedSegment.nextIndex;
14050
+ continue;
14051
+ }
14052
+ if (character === "@") {
14053
+ throw new Error("JSONPath current node selector (@) is not supported");
14054
+ }
14055
+ if (character.trim() === "") {
14056
+ index += 1;
14057
+ continue;
14058
+ }
14059
+ throw new Error(`Unexpected character "${character}" in JSONPath`);
14060
+ }
14061
+ return segments;
14062
+ }
14063
+ function parseDotSegment(pathString, startIndex) {
14064
+ if (startIndex >= pathString.length) {
14065
+ throw new Error("JSONPath cannot end with a period");
14066
+ }
14067
+ if (pathString[startIndex] === "*") {
14068
+ return { value: "*", nextIndex: startIndex + 1, isWildcard: true };
14069
+ }
14070
+ const firstCharacter = pathString[startIndex];
14071
+ if (firstCharacter === "@") {
14072
+ throw new Error("JSONPath current node selector (@) is not supported");
14073
+ }
14074
+ if (!isIdentifierStartCharacter(firstCharacter)) {
14075
+ throw new Error("JSONPath property names after period must start with a letter, $ or _");
14076
+ }
14077
+ let endIndex = startIndex + 1;
14078
+ while (endIndex < pathString.length && isIdentifierCharacter(pathString[endIndex])) {
14079
+ endIndex++;
14080
+ }
14081
+ if (endIndex === startIndex) {
14082
+ throw new Error("JSONPath is missing a property name after period");
14083
+ }
14084
+ return {
14085
+ value: pathString.slice(startIndex, endIndex),
14086
+ nextIndex: endIndex,
14087
+ isWildcard: false
14088
+ };
14089
+ }
14090
+ function parseBracketSegment(pathString, startIndex) {
14091
+ const contentStartIndex = startIndex + 1;
14092
+ if (contentStartIndex >= pathString.length) {
14093
+ throw new Error("JSONPath has unterminated bracket");
14094
+ }
14095
+ const firstCharacter = pathString[contentStartIndex];
14096
+ if (firstCharacter === "'" || firstCharacter === '"') {
14097
+ const { value, nextIndex } = parseBracketProperty(pathString, contentStartIndex);
14098
+ return { type: "property", value, nextIndex };
14099
+ }
14100
+ const closingBracketIndex = pathString.indexOf("]", contentStartIndex);
14101
+ if (closingBracketIndex === -1) {
14102
+ throw new Error("JSONPath has unterminated bracket");
14103
+ }
14104
+ const content = pathString.slice(contentStartIndex, closingBracketIndex).trim();
14105
+ const unsupportedSelectorMessage = getUnsupportedBracketSelectorMessage(content);
14106
+ if (unsupportedSelectorMessage) {
14107
+ throw new Error(unsupportedSelectorMessage);
14108
+ }
14109
+ if (content === "*") {
14110
+ return { type: "array-selector", nextIndex: closingBracketIndex + 1 };
14111
+ }
14112
+ if (/^\d+$/.test(content)) {
14113
+ throw new Error("JSONPath array index selectors are not supported");
14114
+ }
14115
+ if (/^\d*\s*:\s*\d*(\s*:\s*\d*)?$/.test(content)) {
14116
+ return { type: "array-selector", nextIndex: closingBracketIndex + 1 };
14117
+ }
14118
+ throw new Error(`Unsupported bracket selector "[${content}]" in JSONPath`);
14119
+ }
14120
+ function getUnsupportedBracketSelectorMessage(content) {
14121
+ if (!content.length) {
14122
+ return "JSONPath bracket selectors cannot be empty";
14123
+ }
14124
+ if (content.startsWith("(")) {
14125
+ return "JSONPath script selectors are not supported";
14126
+ }
14127
+ if (content.startsWith("?")) {
14128
+ return "JSONPath filter selectors are not supported";
14129
+ }
14130
+ if (content.includes(",")) {
14131
+ return "JSONPath union selectors are not supported";
14132
+ }
14133
+ if (content.startsWith("@") || content.includes("@.")) {
14134
+ return "JSONPath current node selector (@) is not supported";
14135
+ }
14136
+ return null;
14137
+ }
14138
+ function parseBracketProperty(pathString, startIndex) {
14139
+ const quoteCharacter = pathString[startIndex];
14140
+ let index = startIndex + 1;
14141
+ let value = "";
14142
+ let terminated = false;
14143
+ while (index < pathString.length) {
14144
+ const character = pathString[index];
14145
+ if (character === "\\") {
14146
+ index += 1;
14147
+ if (index >= pathString.length) {
14148
+ break;
14149
+ }
14150
+ value += pathString[index];
14151
+ index += 1;
14152
+ continue;
14153
+ }
14154
+ if (character === quoteCharacter) {
14155
+ terminated = true;
14156
+ index += 1;
14157
+ break;
14158
+ }
14159
+ value += character;
14160
+ index += 1;
14161
+ }
14162
+ if (!terminated) {
14163
+ throw new Error("JSONPath string in bracket property selector is unterminated");
14164
+ }
14165
+ while (index < pathString.length && pathString[index].trim() === "") {
14166
+ index += 1;
14167
+ }
14168
+ if (pathString[index] !== "]") {
14169
+ throw new Error("JSONPath property selectors must end with ]");
14170
+ }
14171
+ if (!value.length) {
14172
+ throw new Error("JSONPath property selectors cannot be empty");
14173
+ }
14174
+ return { value, nextIndex: index + 1 };
14175
+ }
14176
+ function isIdentifierCharacter(character) {
14177
+ return /[a-zA-Z0-9$_]/.test(character);
14178
+ }
14179
+ function isIdentifierStartCharacter(character) {
14180
+ return /[a-zA-Z_$]/.test(character);
14181
+ }
14182
+ function isIdentifierSegment(segment) {
14183
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(segment);
14184
+ }
14185
+ function formatJsonPath(path) {
14186
+ return path.map((segment, index) => {
14187
+ if (index === 0) {
14188
+ return segment;
14189
+ }
14190
+ if (segment === "*") {
14191
+ return ".*";
14192
+ }
14193
+ if (isIdentifierSegment(segment)) {
14194
+ return `.${segment}`;
14195
+ }
14196
+ const escapedSegment = segment.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
14197
+ return `['${escapedSegment}']`;
14198
+ }).join("");
14199
+ }
13984
14200
 
13985
14201
  // src/lib/json-parser/json-parser.ts
13986
14202
  var JSONParser = class {
@@ -14160,12 +14376,12 @@ Char: ${this.c}`;
14160
14376
 
14161
14377
  // src/lib/parsers/parse-json-in-batches.ts
14162
14378
  async function* parseJSONInBatches(binaryAsyncIterator, options) {
14163
- const asyncIterator = makeTextDecoderIterator(binaryAsyncIterator);
14164
- const { metadata } = options;
14379
+ const asyncIterator = makeTextDecoderIterator(toArrayBufferIterator(binaryAsyncIterator));
14380
+ const metadata = Boolean(options?.core?.metadata || options?.metadata);
14165
14381
  const { jsonpaths } = options.json || {};
14166
14382
  let isFirstChunk = true;
14167
14383
  const schema = null;
14168
- const tableBatchBuilder = new TableBatchBuilder(schema, options);
14384
+ const tableBatchBuilder = new TableBatchBuilder(schema, options?.core);
14169
14385
  const parser = new StreamingJSONParser({ jsonpaths });
14170
14386
  for await (const chunk of asyncIterator) {
14171
14387
  const rows = parser.write(chunk);
@@ -14221,7 +14437,7 @@ Char: ${this.c}`;
14221
14437
  }
14222
14438
 
14223
14439
  // src/geojson-loader.ts
14224
- var VERSION = true ? "4.4.0-alpha.1" : "latest";
14440
+ var VERSION = true ? "4.4.0-alpha.9" : "latest";
14225
14441
  var GeoJSONWorkerLoader = {
14226
14442
  dataType: null,
14227
14443
  batchType: null,
@@ -14284,7 +14500,8 @@ Char: ${this.c}`;
14284
14500
  }
14285
14501
  function parseInBatches(asyncIterator, options) {
14286
14502
  options = { ...GeoJSONLoader.options, ...options };
14287
- options.json = { ...GeoJSONLoader.options.geojson, ...options.geojson };
14503
+ options.json = { ...GeoJSONLoader.options.json, ...options.json };
14504
+ options.geojson = { ...GeoJSONLoader.options.geojson, ...options.geojson };
14288
14505
  const geojsonIterator = parseJSONInBatches(asyncIterator, options);
14289
14506
  switch (options.gis.format) {
14290
14507
  case "binary":
@@ -25,3 +25,4 @@ export const GeoJSONWriter = {
25
25
  },
26
26
  encodeInBatches: (tableIterator, options) => encodeTableAsGeojsonInBatches(tableIterator, options)
27
27
  };
28
+ //# sourceMappingURL=geojson-writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geojson-writer.js","sourceRoot":"","sources":["../src/geojson-writer.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AACpC,kCAAkC;AAElC,OAAO,EAGL,4BAA4B,EAC7B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAC,6BAA6B,EAAC,0CAAuC;AAU7E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,EAAE,EAAE,SAAS;IACb,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,sBAAsB,CAAC;IACnC,IAAI,EAAE,IAAI;IACV,OAAO,EAAE;QACP,OAAO,EAAE;YACP,YAAY,EAAE,KAAK;YACnB,cAAc,EAAE,IAAI;SACrB;KACF;IAED,KAAK,CAAC,MAAM,CAAC,KAAY,EAAE,OAA6B;QACtD,MAAM,aAAa,GAAG,CAAC,KAAK,CAAiB,CAAC;QAC9C,MAAM,OAAO,GAAG,6BAA6B,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACtE,OAAO,MAAM,4BAA4B,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,eAAe,EAAE,CAAC,aAA+D,EAAE,OAAO,EAAE,EAAE,CAC5F,6BAA6B,CAAC,aAAa,EAAE,OAAO,CAAC;CACsB,CAAC"}