Files
test-repo/tests/method-chain/conditional.js
T
Lucas Duailibe 955a2c1472 Keep conditional expressions in one line on method chains (#2784)
Fixes #2775.

This commit will make conditional expressions to match the behavior of
logical expression in method chains:

```js
(a ? b : c).map()

// if the conditional fits in oneline
(a ? b : c)
  .map()

// if the conditional doesn't fit
(a
  ? b
  : c)
  .map()
```
2017-09-10 08:34:55 -07:00

10 lines
213 B
JavaScript

(valid
? helper.responseBody(this.currentUser)
: helper.response(401))
.map(res => res.json());
(valid
? helper.responseBody(this.currentUser)
: helper.responseBody(defaultUser))
.map(res => res.json());