mirror of
https://github.com/flarum/framework.git
synced 2025-02-02 04:43:17 +08:00
extractText: Avoid unnecessary variable
This commit is contained in:
parent
c67d6c8c61
commit
43c4c1fe9f
10
framework/core/js/admin/dist/app.js
vendored
10
framework/core/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
framework/core/js/forum/dist/app.js
vendored
10
framework/core/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