mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 15:28:01 +08:00

* 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
17 lines
558 B
TypeScript
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);
|
|
};
|