mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 17:52:24 +08:00
17 lines
592 B
TypeScript
17 lines
592 B
TypeScript
import { FeatureLike } from 'ol/Feature';
|
|
|
|
import { compareValues } from '@grafana/data/src/transformations/matchers/compareValues';
|
|
|
|
import { FeatureRuleConfig } from '../types';
|
|
|
|
/**
|
|
* Check whether feature has property value that matches rule
|
|
* @param rule - style rule with an operation, property, and value
|
|
* @param feature - feature with properties and values
|
|
* @returns boolean
|
|
*/
|
|
export const checkFeatureMatchesStyleRule = (rule: FeatureRuleConfig, feature: FeatureLike) => {
|
|
const val = feature.get(rule.property);
|
|
return compareValues(val, rule.operation, rule.value);
|
|
};
|