- From: Adam Rice <notifications@github.com>
- Date: Fri, 27 Oct 2017 05:32:19 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 27 October 2017 12:32:54 UTC
ricea commented on this pull request. > + function replaceFunc(match, p1, offset) { + let replacement = substitutions[p1]; + if (replacement === undefined) { + replacement = ""; + } + lastIndex = offset + replacement.length; + return replacement; + } + chunk = chunk.replace(/\{\{([a-zA-Z0-9_-]+)\}\}/g, replaceFunc); + // Regular expression for an incomplete template at the end of a string. + const partialAtEndRegexp = /\{(\{([a-zA-Z0-9_-]+(\})?)?)?$/g; + // Avoid looking at any characters that have already been substituted. + partialAtEndRegexp.lastIndex = lastIndex; + const match = partialAtEndRegexp.exec(chunk); + if (match) { + partialChunk = chunk.substr(match.index); Resolved by replacing the function with a class :-) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/pull/846#discussion_r147398378
Received on Friday, 27 October 2017 12:32:54 UTC