mirror of
https://github.com/flarum/core.git
synced 2025-07-12 20:36:28 +02:00
extractText: Avoid unnecessary variable
This commit is contained in:
10
js/admin/dist/app.js
vendored
10
js/admin/dist/app.js
vendored
@ -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
10
js/forum/dist/app.js
vendored
@ -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);
|
||||||
|
@ -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;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user