@dra2020/dra-types 1.0.5 → 1.0.8
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/dra-types.d.ts +5 -1
- package/dist/dra-types.js +44 -0
- package/dist/dra-types.js.map +1 -1
- package/lib/dra-types.ts +32 -1
- package/package.json +1 -1
package/dist/dra-types.d.ts
CHANGED
|
@@ -23,11 +23,15 @@ export interface UserLikes {
|
|
|
23
23
|
}
|
|
24
24
|
export interface SplitBlock {
|
|
25
25
|
id?: string;
|
|
26
|
+
chunk?: string;
|
|
26
27
|
state: string;
|
|
27
28
|
datasource: string;
|
|
28
29
|
geoid: string;
|
|
29
30
|
blocks: string[];
|
|
30
31
|
}
|
|
31
32
|
export declare type DistrictToSplitBlock = {
|
|
32
|
-
[nDistrict: number]: SplitBlock;
|
|
33
|
+
[nDistrict: number]: SplitBlock[];
|
|
33
34
|
};
|
|
35
|
+
export declare function vgeoidToGeoid(vgeoid: string): string;
|
|
36
|
+
export declare function vgeoidToChunk(vgeoid: string): string;
|
|
37
|
+
export declare function isVfeature(geoid: string): boolean;
|
package/dist/dra-types.js
CHANGED
|
@@ -105,7 +105,51 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
105
105
|
|
|
106
106
|
"use strict";
|
|
107
107
|
|
|
108
|
+
function __export(m) {
|
|
109
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
110
|
+
}
|
|
108
111
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
112
|
+
__export(__webpack_require__(/*! ./dra-types */ "./lib/dra-types.ts"));
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
/***/ }),
|
|
116
|
+
|
|
117
|
+
/***/ "./lib/dra-types.ts":
|
|
118
|
+
/*!**************************!*\
|
|
119
|
+
!*** ./lib/dra-types.ts ***!
|
|
120
|
+
\**************************/
|
|
121
|
+
/*! no static exports found */
|
|
122
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
123
|
+
|
|
124
|
+
"use strict";
|
|
125
|
+
|
|
126
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
127
|
+
function vgeoidToGeoid(vgeoid) {
|
|
128
|
+
let re = /vfeature_([^_]*)_.*/;
|
|
129
|
+
let a = re.exec(vgeoid);
|
|
130
|
+
if (a == null || a.length != 2)
|
|
131
|
+
return '';
|
|
132
|
+
else
|
|
133
|
+
return a[1];
|
|
134
|
+
}
|
|
135
|
+
exports.vgeoidToGeoid = vgeoidToGeoid;
|
|
136
|
+
function vgeoidToChunk(vgeoid) {
|
|
137
|
+
// vgeoid is string of form: "vfeature_[geoid]_[chunkid]_[hash]"
|
|
138
|
+
// the contents are chunked into a file of form "vfeature_chunk_[chunkid]"
|
|
139
|
+
// So extract the chunk ID and download that.
|
|
140
|
+
let re = /vfeature_([^_]*)_([^_*])_(.*)/;
|
|
141
|
+
let a = re.exec(vgeoid);
|
|
142
|
+
if (a && a.length == 4)
|
|
143
|
+
vgeoid = `vfeature_chunk_${a[2]}`;
|
|
144
|
+
else
|
|
145
|
+
vgeoid = null;
|
|
146
|
+
return vgeoid;
|
|
147
|
+
}
|
|
148
|
+
exports.vgeoidToChunk = vgeoidToChunk;
|
|
149
|
+
function isVfeature(geoid) {
|
|
150
|
+
return geoid.indexOf('vfeature') === 0;
|
|
151
|
+
}
|
|
152
|
+
exports.isVfeature = isVfeature;
|
|
109
153
|
|
|
110
154
|
|
|
111
155
|
/***/ })
|
package/dist/dra-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://dra-types/webpack/universalModuleDefinition","webpack://dra-types/webpack/bootstrap"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA","file":"dra-types.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"dra-types\"] = factory();\n\telse\n\t\troot[\"dra-types\"] = factory();\n})(global, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./lib/all.ts\");\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack://dra-types/webpack/universalModuleDefinition","webpack://dra-types/webpack/bootstrap","webpack://dra-types/./lib/all.ts","webpack://dra-types/./lib/dra-types.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA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ED,SAAgB,UAAU,CAAC,KAAa;IAEtC,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAHD,gCAGC","file":"dra-types.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"dra-types\"] = factory();\n\telse\n\t\troot[\"dra-types\"] = factory();\n})(global, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./lib/all.ts\");\n","export * from './dra-types';\n","// Type for single comment\nexport interface Comment\n{\n userid: string;\n text: string;\n date: string;\n recommend: number;\n}\n\n// Comment record associated with a map\nexport interface CommentList\n{\n id?: string;\n [commentid: string]: Comment | string; // Really just Comment but make TypeScript happy\n}\n\n// Supported like kinds\nexport type LikeKind = 'like' | 'love' | 'wow' | 'angry' | 'funny';\n\n// Like record for an individual like\nexport interface Like\n{\n date: string;\n kind: LikeKind;\n}\n\n// Record for likes associated with a map\nexport interface LikeList\n{\n id?: string;\n [userid: string]: Like | string; // Really just Like but make TypeScript happy\n}\n\n// Record for likes an individual user has performed\nexport interface UserLikes\n{\n id?: string;\n [aid: string]: Like | string; // Really just Like but make TypeScript happy\n}\n\nexport interface SplitBlock\n{\n id?: string;\n chunk?: string;\n state: string;\n datasource: string;\n geoid: string;\n blocks: string[];\n}\n\nexport type DistrictToSplitBlock = { [nDistrict: number]: SplitBlock[] };\n\nexport function vgeoidToGeoid(vgeoid: string): string\n{\n let re = /vfeature_([^_]*)_.*/;\n let a = re.exec(vgeoid);\n if (a == null || a.length != 2)\n return '';\n else\n return a[1];\n}\n\nexport function vgeoidToChunk(vgeoid: string): string\n{\n // vgeoid is string of form: \"vfeature_[geoid]_[chunkid]_[hash]\"\n // the contents are chunked into a file of form \"vfeature_chunk_[chunkid]\"\n // So extract the chunk ID and download that.\n let re = /vfeature_([^_]*)_([^_*])_(.*)/;\n let a = re.exec(vgeoid);\n if (a && a.length == 4)\n vgeoid = `vfeature_chunk_${a[2]}`;\n else\n vgeoid = null;\n\n return vgeoid;\n}\n\nexport function isVfeature(geoid: string): boolean\n{\n return geoid.indexOf('vfeature') === 0;\n}\n"],"sourceRoot":""}
|
package/lib/dra-types.ts
CHANGED
|
@@ -41,10 +41,41 @@ export interface UserLikes
|
|
|
41
41
|
export interface SplitBlock
|
|
42
42
|
{
|
|
43
43
|
id?: string;
|
|
44
|
+
chunk?: string;
|
|
44
45
|
state: string;
|
|
45
46
|
datasource: string;
|
|
46
47
|
geoid: string;
|
|
47
48
|
blocks: string[];
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
export type DistrictToSplitBlock = { [nDistrict: number]: SplitBlock };
|
|
51
|
+
export type DistrictToSplitBlock = { [nDistrict: number]: SplitBlock[] };
|
|
52
|
+
|
|
53
|
+
export function vgeoidToGeoid(vgeoid: string): string
|
|
54
|
+
{
|
|
55
|
+
let re = /vfeature_([^_]*)_.*/;
|
|
56
|
+
let a = re.exec(vgeoid);
|
|
57
|
+
if (a == null || a.length != 2)
|
|
58
|
+
return '';
|
|
59
|
+
else
|
|
60
|
+
return a[1];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function vgeoidToChunk(vgeoid: string): string
|
|
64
|
+
{
|
|
65
|
+
// vgeoid is string of form: "vfeature_[geoid]_[chunkid]_[hash]"
|
|
66
|
+
// the contents are chunked into a file of form "vfeature_chunk_[chunkid]"
|
|
67
|
+
// So extract the chunk ID and download that.
|
|
68
|
+
let re = /vfeature_([^_]*)_([^_*])_(.*)/;
|
|
69
|
+
let a = re.exec(vgeoid);
|
|
70
|
+
if (a && a.length == 4)
|
|
71
|
+
vgeoid = `vfeature_chunk_${a[2]}`;
|
|
72
|
+
else
|
|
73
|
+
vgeoid = null;
|
|
74
|
+
|
|
75
|
+
return vgeoid;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function isVfeature(geoid: string): boolean
|
|
79
|
+
{
|
|
80
|
+
return geoid.indexOf('vfeature') === 0;
|
|
81
|
+
}
|