ol 10.0.1-dev.1723061166717 → 10.0.1-dev.1723216132990

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/expr/cpu.js CHANGED
@@ -115,7 +115,8 @@ function compileExpression(expression, context) {
115
115
  return compileAssertionExpression(expression, context);
116
116
  }
117
117
  case Ops.Get:
118
- case Ops.Var: {
118
+ case Ops.Var:
119
+ case Ops.Has: {
119
120
  return compileAccessorExpression(expression, context);
120
121
  }
121
122
  case Ops.Id: {
@@ -256,6 +257,24 @@ function compileAccessorExpression(expression, context) {
256
257
  case Ops.Var: {
257
258
  return (context) => context.variables[name];
258
259
  }
260
+ case Ops.Has: {
261
+ return (context) => {
262
+ const args = expression.args;
263
+ if (!(name in context.properties)) {
264
+ return false;
265
+ }
266
+ let value = context.properties[name];
267
+ for (let i = 1, ii = args.length; i < ii; ++i) {
268
+ const keyExpression = /** @type {LiteralExpression} */ (args[i]);
269
+ const key = /** @type {string|number} */ (keyExpression.value);
270
+ if (!value || !Object.hasOwn(value, key)) {
271
+ return false;
272
+ }
273
+ value = value[key];
274
+ }
275
+ return true;
276
+ };
277
+ }
259
278
  default: {
260
279
  throw new Error(`Unsupported accessor operator ${expression.operator}`);
261
280
  }
@@ -193,6 +193,8 @@ export type ArgValidator = (arg0: Array<EncodedExpression>, arg1: number, arg2:
193
193
  * * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.
194
194
  * * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.
195
195
  * * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.
196
+ * * `['has', attributeName, keyOrArrayIndex, ...]` returns `true` if feature properties include the (nested) key `attributeName`,
197
+ * `false` otherwise.
196
198
  * * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
197
199
  * (inclusively), or `false` otherwise.
198
200
  * * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and
@@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D;;GAEG;AAEH;IACE;;;OAGG;IACH,kBAHW,MAAM,SACN,YAAY,EAUtB;IAFC,aAAgB;IAChB,oBAAkB;CAErB;AAED;IACE;;;;OAIG;IACH,kBAJW,MAAM,YACN,MAAM,WACH,UAAU,EAAA,EAMvB;IAHC,aAAgB;IAChB,iBAAwB;IACxB,mBAAgB;CAEnB;AAiID;;GAEG;AACH,kBAFU;QAAO,MAAM,GAAE,MAAM;CAAC,CAiD9B;yBAhLW,iBAAiB,GAAC,cAAc;;;;;eAK/B,GAAG,CAAC,MAAM,CAAC;;;;gBACX,GAAG,CAAC,MAAM,CAAC;;;;eACX,OAAO;;;;kBACP,OAAO;;gCAgBR,YAAY,QAAM;;;;;2BAuUlB,CAAS,IAAwB,EAAxB,KAAK,CAAC,iBAAiB,CAAC,EAAE,IAAM,EAAN,MAAM,EAAE,IAAc,EAAd,cAAc,KAAE,KAAK,CAAC,UAAU,CAAC,GAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAldjF,KAAK,CAAC,GAAC,CAAC,GAAC,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,MAAM,GAAC,OAAO;2BAkF1D,OAAO,GAAC,MAAM,GAAC,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;;;;qBAoNnC,CAAS,IAAK,SAAE,IAAM,EAAN,MAAM,EAAE,IAAc,EAAd,cAAc,KAAE,UAAU"}
@@ -91,6 +91,8 @@ import {toSize} from '../size.js';
91
91
  * * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.
92
92
  * * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.
93
93
  * * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.
94
+ * * `['has', attributeName, keyOrArrayIndex, ...]` returns `true` if feature properties include the (nested) key `attributeName`,
95
+ * `false` otherwise.
94
96
  * * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
95
97
  * (inclusively), or `false` otherwise.
96
98
  * * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and
@@ -414,6 +416,7 @@ export const Ops = {
414
416
  Band: 'band',
415
417
  Palette: 'palette',
416
418
  ToString: 'to-string',
419
+ Has: 'has',
417
420
  };
418
421
 
419
422
  /**
@@ -428,6 +431,7 @@ export const Ops = {
428
431
  const parsers = {
429
432
  [Ops.Get]: createCallExpressionParser(hasArgsCount(1, Infinity), withGetArgs),
430
433
  [Ops.Var]: createCallExpressionParser(hasArgsCount(1, 1), withVarArgs),
434
+ [Ops.Has]: createCallExpressionParser(hasArgsCount(1, Infinity), withGetArgs),
431
435
  [Ops.Id]: createCallExpressionParser(usesFeatureId, withNoArgs),
432
436
  [Ops.Concat]: createCallExpressionParser(
433
437
  hasArgsCount(2, Infinity),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol",
3
- "version": "10.0.1-dev.1723061166717",
3
+ "version": "10.0.1-dev.1723216132990",
4
4
  "description": "OpenLayers mapping library",
5
5
  "keywords": [
6
6
  "map",
package/util.js CHANGED
@@ -33,4 +33,4 @@ export function getUid(obj) {
33
33
  * OpenLayers version.
34
34
  * @type {string}
35
35
  */
36
- export const VERSION = '10.0.1-dev.1723061166717';
36
+ export const VERSION = '10.0.1-dev.1723216132990';