Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
noahlemen authored and Noah Lemen committed Aug 23, 2017
1 parent 96a3a11 commit 58391de
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/babel-plugin-transform-es2015-template-literals/README.md
Expand Up @@ -42,8 +42,7 @@ With options:
{
"plugins": [
["transform-es2015-template-literals", {
"loose": true,
"spec": true
"loose": true
}]
]
}
Expand All @@ -69,22 +68,24 @@ require("babel-core").transform("code", {

`boolean`, defaults to `false`.

In loose mode, tagged template literal objects aren't frozen.
When `true`, tagged template literal objects aren't frozen. All template literal expressions and quasis are combined with the `+` operator instead of with `String.prototype.concat`.

### `spec`

`boolean`, defaults to `false`.

This option combines all template literal expressions and quasis with `String.prototype.concat`. It will handle cases with `Symbol.toPrimitive` correctly and throw correctly if template literal expression is a `Symbol()`. See [babel/babel#5791](https://github.com/babel/babel/pull/5791).
When `false` or not set, combines all template literal expressions and quasis with `String.prototype.concat`. It will handle cases with `Symbol.toPrimitive` correctly and throw correctly if template literal expression is a `Symbol()`. See [babel/babel#5791](https://github.com/babel/babel/pull/5791).

**In**

```javascript
`foo${bar}baz${quux}${1}`;
```

**Out**
**Out (without `{"loose": true}`)**

```javascript
"foo".concat(bar, "baz").concat(quux, 1);
```

**Out (with `{"loose": true}`)**

```javascript
"foo" + bar + "baz" + quux + 1;
```

0 comments on commit 58391de

Please sign in to comment.