Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError of stripIndent when use invalid use of octal escape sequences in template strings #210

Open
seongwon-kang opened this issue Nov 27, 2020 · 0 comments · May be fixed by #211
Open

Comments

@seongwon-kang
Copy link

seongwon-kang commented Nov 27, 2020

Currently this code will give an TypeError.

stripIndent`
    \4
`

Result is:

/home/vagrant/test/node_modules/common-tags/lib/stripIndentTransformer/stripIndentTransformer.js:20
        var match = endResult.match(/^[^\S\n]*(?=\S)/gm);
                              ^

TypeError: Cannot read property 'match' of undefined
    at Object.onEndResult (/home/vagrant/test/node_modules/common-tags/lib/stripIndentTransformer/stripIndentTransformer.js:20:31)
    at cb (/home/vagrant/test/node_modules/common-tags/lib/TemplateTag/TemplateTag.js:161:50)
    at Array.reduce (<anonymous>)
    at TemplateTag.transformEndResult (/home/vagrant/test/node_modules/common-tags/lib/TemplateTag/TemplateTag.js:163:32)
    at TemplateTag.tag (/home/vagrant/test/node_modules/common-tags/lib/TemplateTag/TemplateTag.js:54:20)

Because of SyntaxError was raised in template string, and TemplateTag.tag will get undefined string.

SyntaxError: Octal escape sequences are not allowed in template strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant