ts-maps 0.3.5 → 0.3.6

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11796,7 +11796,7 @@ function evaluateFilterLegacy(filter, feature) {
11796
11796
  const key3 = rest[0];
11797
11797
  return typeof key3 === "string" && !(key3 in feature.properties);
11798
11798
  }
11799
- const left = resolveOperand(rest[0], feature);
11799
+ const left = resolveLegacyKey(rest[0], feature);
11800
11800
  if (op === "==" || op === "!=") {
11801
11801
  const right = resolveOperand(rest[1], feature);
11802
11802
  return op === "==" ? left === right : left !== right;
@@ -11817,6 +11817,19 @@ function evaluateFilterLegacy(filter, feature) {
11817
11817
  }
11818
11818
  return true;
11819
11819
  }
11820
+ function resolveLegacyKey(node, feature) {
11821
+ if (Array.isArray(node))
11822
+ return resolveOperand(node, feature);
11823
+ if (node === "$type") {
11824
+ const t = feature.type;
11825
+ return t === 1 ? "Point" : t === 2 ? "LineString" : t === 3 ? "Polygon" : "Unknown";
11826
+ }
11827
+ if (node === "$id")
11828
+ return feature.id ?? null;
11829
+ if (typeof node === "string")
11830
+ return feature.properties[node] ?? null;
11831
+ return node;
11832
+ }
11820
11833
  function resolveOperand(node, feature) {
11821
11834
  if (Array.isArray(node)) {
11822
11835
  if (node[0] === "get" && typeof node[1] === "string")
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ts-maps",
3
3
  "type": "module",
4
- "version": "0.3.5",
4
+ "version": "0.3.6",
5
5
  "description": "A modern vector map library.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",