MCPcopy Create free account
hub / github.com/OpenIntroStat/ims / unpackPadding

Function unpackPadding

libs/htmlwidgets-1.5.3/htmlwidgets.js:172–187  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

170 // the "padding" CSS property
171 // https://developer.mozilla.org/en-US/docs/Web/CSS/padding
172 function unpackPadding(value) {
173 if (typeof(value) === "number")
174 value = [value];
175 if (value.length === 1) {
176 return {top: value[0], right: value[0], bottom: value[0], left: value[0]};
177 }
178 if (value.length === 2) {
179 return {top: value[0], right: value[1], bottom: value[0], left: value[1]};
180 }
181 if (value.length === 3) {
182 return {top: value[0], right: value[1], bottom: value[2], left: value[1]};
183 }
184 if (value.length === 4) {
185 return {top: value[0], right: value[1], bottom: value[2], left: value[3]};
186 }
187 }
188
189 // Convert an unpacked padding object to a CSS value
190 function paddingToCss(paddingObj) {

Callers 1

initSizingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected