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

Function convertToMargins

packages/core/ui/styling/style-properties.ts:219–237  ·  view source on GitHub ↗
(value: string | CoreTypes.PercentLengthType)

Source from the content-addressed store, hash-verified

217}
218
219function convertToMargins(value: string | CoreTypes.PercentLengthType): [CssProperty<Style, CoreTypes.PercentLengthType>, CoreTypes.PercentLengthType][] {
220 if (typeof value === 'string' && value !== 'auto') {
221 const thickness = parseShorthandPositioning(value);
222
223 return [
224 [marginTopProperty, PercentLength.parse(thickness.top)],
225 [marginRightProperty, PercentLength.parse(thickness.right)],
226 [marginBottomProperty, PercentLength.parse(thickness.bottom)],
227 [marginLeftProperty, PercentLength.parse(thickness.left)],
228 ];
229 } else {
230 return [
231 [marginTopProperty, value],
232 [marginRightProperty, value],
233 [marginBottomProperty, value],
234 [marginLeftProperty, value],
235 ];
236 }
237}
238
239function convertToPaddings(value: string | CoreTypes.LengthType): [CssProperty<Style, CoreTypes.LengthType>, CoreTypes.LengthType][] {
240 if (typeof value === 'string' && value !== 'auto') {

Callers

nothing calls this directly

Calls 2

parseMethod · 0.65

Tested by

no test coverage detected