Eliminate if-statement (#3555)

This commit is contained in:
Aya Morisawa 2018-12-09 03:40:40 +09:00 committed by GitHub
parent 1de8e1eeb1
commit 54cb94db1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,11 +126,7 @@ export default (tokens: Node[], mentionedRemoteUsers: INote['mentionedRemoteUser
const nodes = (token.props.text as string).split('\n').map(x => doc.createTextNode(x));
for (const x of intersperse('br', nodes)) {
if (x === 'br') {
el.appendChild(doc.createElement('br'));
} else {
el.appendChild(x);
}
el.appendChild(x === 'br' ? doc.createElement('br') : x);
}
return el;