Convert var to const/let (except in browser-only code).

This commit is contained in:
David Anson 2018-04-27 22:05:34 -07:00
parent 78c1af7bfd
commit 213aef4564
56 changed files with 524 additions and 518 deletions

View file

@ -2,21 +2,21 @@
"use strict";
var shared = require("./shared");
const shared = require("./shared");
module.exports = {
"names": [ "MD036", "no-emphasis-as-heading", "no-emphasis-as-header" ],
"description": "Emphasis used instead of a heading",
"tags": [ "headings", "headers", "emphasis" ],
"function": function MD036(params, onError) {
var punctuation = params.config.punctuation || ".,;:!?";
var re = new RegExp("[" + punctuation + "]$");
const punctuation = params.config.punctuation || ".,;:!?";
const re = new RegExp("[" + punctuation + "]$");
function base(token) {
if (token.type === "paragraph_open") {
return function inParagraph(t) {
// Always paragraph_open/inline/paragraph_close,
// omit (t.type === "inline")
var children = t.children.filter(function notEmptyText(child) {
const children = t.children.filter(function notEmptyText(child) {
return (child.type !== "text") || (child.content !== "");
});
if ((children.length === 3) &&
@ -46,7 +46,7 @@ module.exports = {
}
return base;
}
var state = base;
let state = base;
params.tokens.forEach(function forToken(token) {
state = state(token);
});