@dra2020/baseclient 1.0.55 → 1.0.59

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/all/all.d.ts CHANGED
@@ -20,3 +20,5 @@ import * as G from '../geo/all';
20
20
  export { G };
21
21
  import * as Emit from '../emit/all';
22
22
  export { Emit };
23
+ import * as CSV from '../csv/all';
24
+ export { CSV };
@@ -39,7 +39,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
39
39
  return result;
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", ({ value: true }));
42
- exports.Emit = exports.G = exports.FilterExpr = exports.OTE = exports.OT = exports.LogClient = exports.LogAbstract = exports.Poly = exports.FSM = exports.Context = exports.Util = void 0;
42
+ exports.CSV = exports.Emit = exports.G = exports.FilterExpr = exports.OTE = exports.OT = exports.LogClient = exports.LogAbstract = exports.Poly = exports.FSM = exports.Context = exports.Util = void 0;
43
43
  // Client and Server
44
44
  const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
45
45
  exports.Util = Util;
@@ -63,6 +63,8 @@ const G = __importStar(__webpack_require__(/*! ../geo/all */ "./lib/geo/all.ts")
63
63
  exports.G = G;
64
64
  const Emit = __importStar(__webpack_require__(/*! ../emit/all */ "./lib/emit/all.ts"));
65
65
  exports.Emit = Emit;
66
+ const CSV = __importStar(__webpack_require__(/*! ../csv/all */ "./lib/csv/all.ts"));
67
+ exports.CSV = CSV;
66
68
 
67
69
 
68
70
  /***/ }),
@@ -169,6 +171,138 @@ function create() {
169
171
  exports.create = create;
170
172
 
171
173
 
174
+ /***/ }),
175
+
176
+ /***/ "./lib/csv/all.ts":
177
+ /*!************************!*\
178
+ !*** ./lib/csv/all.ts ***!
179
+ \************************/
180
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
181
+
182
+
183
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
184
+ if (k2 === undefined) k2 = k;
185
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
186
+ }) : (function(o, m, k, k2) {
187
+ if (k2 === undefined) k2 = k;
188
+ o[k2] = m[k];
189
+ }));
190
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
191
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
192
+ };
193
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
194
+ __exportStar(__webpack_require__(/*! ./csv */ "./lib/csv/csv.ts"), exports);
195
+
196
+
197
+ /***/ }),
198
+
199
+ /***/ "./lib/csv/csv.ts":
200
+ /*!************************!*\
201
+ !*** ./lib/csv/csv.ts ***!
202
+ \************************/
203
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
204
+
205
+
206
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
207
+ if (k2 === undefined) k2 = k;
208
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
209
+ }) : (function(o, m, k, k2) {
210
+ if (k2 === undefined) k2 = k;
211
+ o[k2] = m[k];
212
+ }));
213
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
214
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
215
+ }) : function(o, v) {
216
+ o["default"] = v;
217
+ });
218
+ var __importStar = (this && this.__importStar) || function (mod) {
219
+ if (mod && mod.__esModule) return mod;
220
+ var result = {};
221
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
222
+ __setModuleDefault(result, mod);
223
+ return result;
224
+ };
225
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
226
+ const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
227
+ // Parse CSV.
228
+ // Fields are separated by commas or pipe symbol (census uses pipe separators.
229
+ // Quoted fields may contain commas or pipes.
230
+ // Either single quotes or double quotes may be used to surround field value.
231
+ // Spaces at the beginning and end of fields are ignored.
232
+ // Quotes must be the first non-space character in the field (otherwise they are part of the field value).
233
+ //
234
+ const Space = 32;
235
+ const Tab = 9;
236
+ const Newline = 10;
237
+ const CR = 13;
238
+ const Comma = 44;
239
+ const SingleQuote = 39;
240
+ const DoubleQuote = 34;
241
+ const BackSlash = 92;
242
+ const Pipe = 124;
243
+ function isWhite(c) {
244
+ return c === Space || c === Newline || c === Tab || c == CR;
245
+ }
246
+ class ParseOne {
247
+ constructor(coder, line) {
248
+ this.coder = coder;
249
+ if (line)
250
+ this.set(line);
251
+ }
252
+ set(line) {
253
+ this.fields = [];
254
+ this.buf = Util.s2u8(this.coder, line);
255
+ this.tok = new Uint8Array(new ArrayBuffer(this.buf.length));
256
+ this.n = 0;
257
+ this.toklen = 0;
258
+ this.infield = false;
259
+ this.nwhite = 0;
260
+ this.quote = 0;
261
+ this.parse();
262
+ }
263
+ get length() { return this.fields.length; }
264
+ pushtok(force) {
265
+ // Trim trailing whitespace
266
+ if (!force)
267
+ this.toklen -= this.nwhite;
268
+ if (this.toklen || force) {
269
+ this.fields.push(Util.u82s(this.coder, this.tok, 0, this.toklen));
270
+ this.toklen = 0;
271
+ }
272
+ this.infield = false;
273
+ this.nwhite = 0;
274
+ this.quote = 0;
275
+ }
276
+ parse() {
277
+ while (this.n < this.buf.length) {
278
+ let c = this.buf[this.n++];
279
+ if (this.quote && c === this.quote)
280
+ this.pushtok(true);
281
+ else if (c === Comma || c === Pipe)
282
+ this.pushtok(true);
283
+ else if (this.infield) {
284
+ this.tok[this.toklen++] = c;
285
+ if (isWhite(c))
286
+ this.nwhite++;
287
+ else
288
+ this.nwhite = 0;
289
+ }
290
+ else if (isWhite(c))
291
+ continue;
292
+ else if (c === SingleQuote || c === DoubleQuote) {
293
+ this.quote = c;
294
+ this.infield = true;
295
+ }
296
+ else {
297
+ this.infield = true;
298
+ this.tok[this.toklen++] = c;
299
+ }
300
+ }
301
+ this.pushtok(false);
302
+ }
303
+ }
304
+
305
+
172
306
  /***/ }),
173
307
 
174
308
  /***/ "./lib/emit/all.ts":
@@ -1314,6 +1448,44 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1314
1448
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1315
1449
  __exportStar(__webpack_require__(/*! ./geo */ "./lib/geo/geo.ts"), exports);
1316
1450
  __exportStar(__webpack_require__(/*! ./vfeature */ "./lib/geo/vfeature.ts"), exports);
1451
+ __exportStar(__webpack_require__(/*! ./flexname */ "./lib/geo/flexname.ts"), exports);
1452
+
1453
+
1454
+ /***/ }),
1455
+
1456
+ /***/ "./lib/geo/flexname.ts":
1457
+ /*!*****************************!*\
1458
+ !*** ./lib/geo/flexname.ts ***!
1459
+ \*****************************/
1460
+ /***/ ((__unused_webpack_module, exports) => {
1461
+
1462
+
1463
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1464
+ exports.flexName = void 0;
1465
+ function flexName(f) {
1466
+ if (!f || !f.properties)
1467
+ return null;
1468
+ let oneOf = ['name', 'entry_name', 'Name', 'NAME',
1469
+ 'NAMELSAD', 'namelsad',
1470
+ 'NAME10', 'name10',
1471
+ 'NAMELSAD10', 'namelsad10',
1472
+ 'NAME20', 'name20',
1473
+ 'NAMELSAD20', 'namelsad20',
1474
+ 'NAME30', 'name30',
1475
+ 'NAMELSAD30', 'namelsad30',
1476
+ ];
1477
+ for (let i = 0; i < oneOf.length; i++)
1478
+ if (f.properties[oneOf[i]] !== undefined) {
1479
+ let name = f.properties[oneOf[i]];
1480
+ if (name.startsWith('Block Group') && f.properties['GEOID10'] !== undefined)
1481
+ return String(f.properties['GEOID10']).substr(2);
1482
+ name = name.replace('Voting Districts', '');
1483
+ name = name.replace('Precinct', '');
1484
+ return name.replace('Voting District', '').trim();
1485
+ }
1486
+ return `${f.properties.id}`;
1487
+ }
1488
+ exports.flexName = flexName;
1317
1489
 
1318
1490
 
1319
1491
  /***/ }),