@india-boundary-corrector/leaflet-layer 0.0.2 → 0.0.3
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/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +6 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -112,10 +112,10 @@ function templateToTemplateRegex(template) {
|
|
|
112
112
|
let pattern = template.replace(/[.*+?^${}()|[\]\\]/g, (char) => {
|
|
113
113
|
if (char === "{" || char === "}") return char;
|
|
114
114
|
return "\\" + char;
|
|
115
|
-
}).replace(/^https:\/\//, "https?://").replace(/^http:\/\//, "https?://").replace(/\{([a-z0-9])-([a-z0-9])\}/gi, (_2, start, end) => `(\\{${start}-${end}\\}|[a-z0-9]+)`).replace(/\{(z|x|y|s|r)\}/gi, (_2, name) => {
|
|
115
|
+
}).replace(/^https:\/\//, "https?://").replace(/^http:\/\//, "https?://").replace(/\{([a-z0-9])-([a-z0-9])\}/gi, (_2, start, end) => `(\\{${start}-${end}\\}|\\{s\\}|[a-z0-9]+)`).replace(/\{(z|x|y|s|r)\}/gi, (_2, name) => {
|
|
116
116
|
const lowerName = name.toLowerCase();
|
|
117
117
|
if (lowerName === "s") {
|
|
118
|
-
return "(\\{s\\}|[a-z0-9]+)";
|
|
118
|
+
return "(\\{s\\}|\\{[a-z0-9]-[a-z0-9]\\}|[a-z0-9]+)";
|
|
119
119
|
}
|
|
120
120
|
if (lowerName === "r") {
|
|
121
121
|
return "(\\{r\\}|@\\d+x)?";
|
|
@@ -149,6 +149,9 @@ var LayerConfig = class _LayerConfig {
|
|
|
149
149
|
if (!id || typeof id !== "string") {
|
|
150
150
|
throw new Error("LayerConfig requires a non-empty string id");
|
|
151
151
|
}
|
|
152
|
+
if (id.includes("/")) {
|
|
153
|
+
throw new Error(`LayerConfig id cannot contain slashes: "${id}"`);
|
|
154
|
+
}
|
|
152
155
|
this.id = id;
|
|
153
156
|
this.startZoom = startZoom;
|
|
154
157
|
this.zoomThreshold = zoomThreshold;
|