@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 CHANGED
@@ -139,10 +139,10 @@ function templateToTemplateRegex(template) {
139
139
  let pattern = template.replace(/[.*+?^${}()|[\]\\]/g, (char) => {
140
140
  if (char === "{" || char === "}") return char;
141
141
  return "\\" + char;
142
- }).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) => {
142
+ }).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) => {
143
143
  const lowerName = name.toLowerCase();
144
144
  if (lowerName === "s") {
145
- return "(\\{s\\}|[a-z0-9]+)";
145
+ return "(\\{s\\}|\\{[a-z0-9]-[a-z0-9]\\}|[a-z0-9]+)";
146
146
  }
147
147
  if (lowerName === "r") {
148
148
  return "(\\{r\\}|@\\d+x)?";
@@ -176,6 +176,9 @@ var LayerConfig = class _LayerConfig {
176
176
  if (!id || typeof id !== "string") {
177
177
  throw new Error("LayerConfig requires a non-empty string id");
178
178
  }
179
+ if (id.includes("/")) {
180
+ throw new Error(`LayerConfig id cannot contain slashes: "${id}"`);
181
+ }
179
182
  this.id = id;
180
183
  this.startZoom = startZoom;
181
184
  this.zoomThreshold = zoomThreshold;