Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit a208cba

Browse files
committed
Fix iteration over attrs
1 parent fe47858 commit a208cba

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/vueTransform.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ import MagicString from 'magic-string';
1313
*/
1414
function checkLang(node) {
1515
if (node.attrs) {
16-
let i = node.attrs.length;
17-
while (i > 0) {
18-
const attr = node.attrs[i];
16+
for (const attr of node.attrs) {
1917
if (attr.name === 'lang') {
2018
return attr.value;
2119
}
22-
i -= 1;
2320
}
2421
}
2522
return undefined;
@@ -167,8 +164,8 @@ export default function vueTransform(code, filePath, options) {
167164

168165
// 4. Process template
169166
const template = nodes.template
170-
? processTemplate(nodes.template, filePath, code, options)
171-
: undefined;
167+
? processTemplate(nodes.template, filePath, code, options)
168+
: undefined;
172169
let js;
173170
if (options.compileTemplate) {
174171
/* eslint-disable */

0 commit comments

Comments
 (0)