mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 14:20:47 +08:00
extractText: Avoid unnecessary variable
This commit is contained in:
parent
25d18d79fb
commit
51da153592
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;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user