extractText: Avoid unnecessary variable

This commit is contained in:
Franz Liedke 2016-03-30 09:59:54 +09:00
parent 25d18d79fb
commit 51da153592
3 changed files with 9 additions and 21 deletions

10
js/admin/dist/app.js vendored
View File

@ -22394,19 +22394,15 @@ System.register("flarum/utils/extract", [], function (_export, _context) {
System.register('flarum/utils/extractText', [], function (_export, _context) { System.register('flarum/utils/extractText', [], function (_export, _context) {
function extractText(vdom) { function extractText(vdom) {
var text = '';
if (vdom instanceof Array) { if (vdom instanceof Array) {
text += vdom.map(function (element) { return vdom.map(function (element) {
return extractText(element); return extractText(element);
}).join(''); }).join('');
} else if ((typeof vdom === 'undefined' ? 'undefined' : babelHelpers.typeof(vdom)) === 'object') { } else if ((typeof vdom === 'undefined' ? 'undefined' : babelHelpers.typeof(vdom)) === 'object') {
text += extractText(vdom.children); return extractText(vdom.children);
} else { } else {
text += vdom; return vdom;
} }
return text;
} }
_export('default', extractText); _export('default', extractText);

10
js/forum/dist/app.js vendored
View File

@ -30406,19 +30406,15 @@ System.register("flarum/utils/extract", [], function (_export, _context) {
System.register('flarum/utils/extractText', [], function (_export, _context) { System.register('flarum/utils/extractText', [], function (_export, _context) {
function extractText(vdom) { function extractText(vdom) {
var text = '';
if (vdom instanceof Array) { if (vdom instanceof Array) {
text += vdom.map(function (element) { return vdom.map(function (element) {
return extractText(element); return extractText(element);
}).join(''); }).join('');
} else if ((typeof vdom === 'undefined' ? 'undefined' : babelHelpers.typeof(vdom)) === 'object') { } else if ((typeof vdom === 'undefined' ? 'undefined' : babelHelpers.typeof(vdom)) === 'object') {
text += extractText(vdom.children); return extractText(vdom.children);
} else { } else {
text += vdom; return vdom;
} }
return text;
} }
_export('default', extractText); _export('default', extractText);

View File

@ -5,15 +5,11 @@
* @return {String} * @return {String}
*/ */
export default function extractText(vdom) { export default function extractText(vdom) {
let text = '';
if (vdom instanceof Array) { if (vdom instanceof Array) {
text += vdom.map(element => extractText(element)).join(''); return vdom.map(element => extractText(element)).join('');
} else if (typeof vdom === 'object') { } else if (typeof vdom === 'object') {
text += extractText(vdom.children); return extractText(vdom.children);
} else { } else {
text += vdom; return vdom;
} }
return text;
} }