Files
grafana/public/app/plugins/panel/geomap/utils/checkFeatureMatchesStyleRule.ts
Jack Westbrook 1ca9910736 Grafana Data: Use package.json exports for internal code (#102696)
* refactor(frontend): rename all @grafana/data/src imports to @grafana/data

* feat(grafana-data): introduce internal entrypoint for sharing code only with grafana

* feat(grafana-data): add test entrypoint for data test utils usage in core

* refactor(frontend): update import paths to use grafana/data exports entrypoints

* docs(grafana-data): update comment in internal/index.ts

* refactor(frontend): prefer public namespaced exports over re-exporting via internal

* chore(frontend): fix a couple more weird paths that typescript complains about
2025-03-25 10:48:36 +01:00

17 lines
558 B
TypeScript

import { FeatureLike } from 'ol/Feature';
import { compareValues } from '@grafana/data/internal';
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);
};