Skip to content

Commit

Permalink
Change the declaration part of the counter variable into on the loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
segayuu committed Oct 24, 2018
1 parent 91fdb68 commit 77c57dc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/plugins/tag/img.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,26 @@ module.exports = ctx => {
return function imgTag(args, content) {
const classes = [];
let src;
let i = 0;

// Find image URL and class name
for (const len = args.length; i < len; i++) {
for (let i = 0, len = args.length; i < len; i++) {
const item = args[i];

if (rUrl.test(item) || item[0] === '/') {
src = makeUrl(item);

// Delete image URL and class name from arguments
args = args.slice(i + 1);
break;
} else {
classes.push(item);
}
}

// Delete image URL and class name from arguments
args = args.slice(i + 1);

let width, height, title, alt;

// Find image width and height
if (args.length) {
if (args && args.length) {
if (!/\D+/.test(args[0])) {
width = args.shift();

Expand Down

0 comments on commit 77c57dc

Please sign in to comment.