@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.
@@ -28,7 +28,7 @@ var IndiaBoundaryCorrector = (() => {
28
28
  });
29
29
 
30
30
  // ../data/version.js
31
- var packageVersion = "0.0.2";
31
+ var packageVersion = "0.0.3";
32
32
 
33
33
  // ../data/index.js
34
34
  var import_meta = {};
@@ -170,10 +170,10 @@ var IndiaBoundaryCorrector = (() => {
170
170
  let pattern = template.replace(/[.*+?^${}()|[\]\\]/g, (char) => {
171
171
  if (char === "{" || char === "}") return char;
172
172
  return "\\" + char;
173
- }).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) => {
173
+ }).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) => {
174
174
  const lowerName = name.toLowerCase();
175
175
  if (lowerName === "s") {
176
- return "(\\{s\\}|[a-z0-9]+)";
176
+ return "(\\{s\\}|\\{[a-z0-9]-[a-z0-9]\\}|[a-z0-9]+)";
177
177
  }
178
178
  if (lowerName === "r") {
179
179
  return "(\\{r\\}|@\\d+x)?";
@@ -207,6 +207,9 @@ var IndiaBoundaryCorrector = (() => {
207
207
  if (!id || typeof id !== "string") {
208
208
  throw new Error("LayerConfig requires a non-empty string id");
209
209
  }
210
+ if (id.includes("/")) {
211
+ throw new Error(`LayerConfig id cannot contain slashes: "${id}"`);
212
+ }
210
213
  this.id = id;
211
214
  this.startZoom = startZoom;
212
215
  this.zoomThreshold = zoomThreshold;