Created
January 29, 2016 01:08
-
-
Save basarat/3e36eed7a8395dcd2a79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function padding(a: any, b?: any, c?: any, d?: any) { | |
if (!b && !c && !d) { | |
b = c = d = a; | |
} | |
else if (!c && !d) { | |
c = a; | |
d = b; | |
} | |
return { | |
paddingTop: _toString(a), | |
paddingRight: _toString(b), | |
paddingBottom: _toString(c), | |
paddingLeft: _toString(d) | |
}; | |
} | |
function _toString(value: any) { | |
if (typeof value === 'number') { | |
return value.toString() + 'px'; | |
} | |
else { | |
return value.toString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment