Skip to content

Instantly share code, notes, and snippets.

@hamed-farag
Last active May 26, 2018 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamed-farag/56c547a06548cca223385e4479ae50b3 to your computer and use it in GitHub Desktop.
Save hamed-farag/56c547a06548cca223385e4479ae50b3 to your computer and use it in GitHub Desktop.
var StyleToString = function (styleString, styleObj) {
var style = '';
if (typeof styleString === 'string') {
style = style + styleString;
}
if (typeof styleString === 'object') {
for (var styleStringProperty in styleString) {
if (styleString[styleStringProperty]) {
style = style + ' ' + styleStringProperty;
}
}
}
if (typeof styleObj === 'object') {
for (var styleProperty in styleObj) {
if (styleObj[styleProperty]) {
style = style + ' ' + styleProperty;
}
}
}
return style.trim();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment