Skip to content

Commit

Permalink
spec/loose/default switch for template literal transform, update/re-o…
Browse files Browse the repository at this point in the history
…rg tests
  • Loading branch information
noahlemen authored and Noah Lemen committed Aug 23, 2017
1 parent 4577bd1 commit 96a3a11
Show file tree
Hide file tree
Showing 58 changed files with 10 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ export default function({ types: t }) {
// since `+` is left-to-right associative
// ensure the first node is a string if first/second isn't
const considerSecondNode =
state.opts.spec || !t.isStringLiteral(nodes[1]);
!state.opts.loose || !t.isStringLiteral(nodes[1]);
if (!t.isStringLiteral(nodes[0]) && considerSecondNode) {
nodes.unshift(t.stringLiteral(""));
}
let root = nodes[0];

if (state.opts.spec) {
if (!state.opts.loose) {
if (nodes.length > 1) {
root = buildConcatCallExressions(nodes);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": [["transform-es2015-template-literals", {"loose": true}]]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var _templateObject = _taggedTemplateLiteralLoose(["wow\na", "b ", ""], ["wow\\na", "b ", ""]);

function _taggedTemplateLiteralLoose(strings, raw) { strings.raw = raw; return strings; }

var foo = bar(_templateObject, 42, _.foobar());

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 96a3a11

Please sign in to comment.