(renderer, styleNames)
| 120 | @return {Function} Function that will wrap the input string with styling |
| 121 | */ |
| 122 | renderStylesFactory(renderer, styleNames) { |
| 123 | let styles; |
| 124 | |
| 125 | if (Array.isArray(styleNames)) { |
| 126 | styles = styleNames.map(checkStyleName.bind(null, renderer)); |
| 127 | } else { |
| 128 | styles = [checkStyleName(renderer, styleNames)]; |
| 129 | } |
| 130 | |
| 131 | return function (match, pattern) { |
| 132 | return styles.reverse().reduce((previous, current) => renderer[current](previous), pattern); |
| 133 | }; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | module.exports = MarkdownColor; |
no test coverage detected