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

Function parseTransformString

packages/core/ui/styling/css-transform.ts:98–112  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

96// properties is faster than using more specific regex
97// https://jsperf.com/cssparse
98function parseTransformString(text: string): Transformation[] {
99 const matches: Transformation[] = [];
100 let match: RegExpExecArray;
101
102 while ((match = TRANSFORM_SPLITTER.exec(text)) !== null) {
103 const property = match[1];
104
105 if (isTransformType(property)) {
106 const value = convertTransformValue(property, match[2]);
107 matches.push(STYLE_TRANSFORMATION_MAP[property](value));
108 }
109 }
110
111 return matches;
112}
113
114function convertTransformValue(property: TransformationType, rawValue: string): TransformationValue {
115 const values = rawValue.split(',').map(parseFloat);

Callers 1

transformConverterFunction · 0.85

Calls 3

isTransformTypeFunction · 0.85
convertTransformValueFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected