Created
October 16, 2019 13:00
-
-
Save lac5/739c922cefb1efc17cdb64a5aafbfa9a 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 default class StyleMap extends Map { | |
toString(space, newline) { | |
let style = ''; | |
for (let [key, value] of this) { | |
style += key; | |
style += ':'; | |
if (typeof space === 'number') { | |
for (let i = 0; i < space; i++) { | |
style += ' '; | |
} | |
} else if (typeof space === 'string') { | |
style += space; | |
} | |
style += value; | |
style += ';'; | |
if (typeof newline === 'string') { | |
style += newline; | |
} else if (typeof space === 'number') { | |
for (let i = 0; i < space; i++) { | |
style += ' '; | |
} | |
} else if (typeof space === 'string') { | |
style += space; | |
} | |
} | |
return style; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment