MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / cleanupImportantFlags

Function cleanupImportantFlags

packages/core/ui/styling/css-utils.ts:5–18  ·  view source on GitHub ↗
(value: unknown, propertyName: string)

Source from the content-addressed store, hash-verified

3import { Length } from './length-shared';
4
5export function cleanupImportantFlags(value: unknown, propertyName: string) {
6 if (typeof value !== 'string') {
7 return '' + value;
8 }
9
10 const index = value?.indexOf('!important');
11 if (index >= 0) {
12 if (Trace.isEnabled()) {
13 Trace.write(`The !important css rule is currently not supported. Property: ${propertyName}`, Trace.categories.Style, Trace.messageType.warn);
14 }
15 return value.substring(0, index).trim();
16 }
17 return value;
18}
19
20/**
21 * Matches whitespace except if the whitespace is contained in parenthesis - e.g. rgb(a), hsl color.

Callers 2

setPropertyValuesMethod · 0.90

Calls 3

indexOfMethod · 0.80
isEnabledMethod · 0.80
writeMethod · 0.65

Tested by

no test coverage detected