MCPcopy Create free account
hub / github.com/codecombat/codecombat / wrapWord

Function wrapWord

ozaria/engine/cinematic/dialogsystem/helper.js:82–94  ·  view source on GitHub ↗
(src, match)

Source from the content-addressed store, hash-verified

80
81 // wrapWord maintains spaces on either side of the word.
82 function wrapWord (src, match) {
83 return replaceHtmlContent(src, match, function (str) {
84 let result = ''
85 if (str[0] === ' ') {
86 result += ' '
87 }
88 result += wrapLetter(wrapWordString(str.trim()), /[^ ]/)
89 if (str.substr(-1) === ' ') {
90 result += ' '
91 }
92 return result
93 })
94 }
95
96 return wrapWord(htmlString, / ?([^ ])+ ?/)
97}

Callers 1

wrapTextFunction · 0.85

Calls 2

replaceHtmlContentFunction · 0.85
wrapLetterFunction · 0.85

Tested by

no test coverage detected