Comparing version 0.1.3 to 0.1.4
@@ -12,3 +12,3 @@ function Deal(str) { | ||
var src = this._src; | ||
return src.slice(0, point) + src.slice(point + 1 + str.length); | ||
return src.slice(0, point) + src.slice(point).replace(str, ''); | ||
}, | ||
@@ -103,7 +103,11 @@ update: function (point, str, newStr) { | ||
"Unescaped '{a}'.": function (str, ch, a) { | ||
return deal(str).insert(ch - 1, '\\'); | ||
var point = ch - 1; | ||
if (a === '-') { | ||
point = ch; | ||
} | ||
return deal(str).insert(point, '\\'); | ||
}, | ||
// 添加转义 | ||
"Unescaped '-'.": function (str, ch, a) { | ||
return deal(str).insert(ch, '\\\\'); | ||
// 多余的转义 | ||
"Bad escapement.": function (str, ch) { | ||
return deal(str).remove(ch - 2, '\\'); | ||
}, | ||
@@ -127,5 +131,25 @@ // 把表达式换成条件语句。 | ||
// 添加逗号后自动修复 | ||
"Line breaking error 'return'.": function (str, ch) { | ||
"Line breaking error '{a}'.": function (str, ch, a) { | ||
return str; | ||
}, | ||
// TODO: 变量不可删除,注释掉代码 | ||
"Variables should not be deleted.": function () { | ||
return false; | ||
}, | ||
// TODO: 控制码 | ||
"Control character in string: {a}.": function () { | ||
return false; | ||
}, | ||
//for-in中变量加上声明 | ||
"Bad for in variable '{a}'.": function (str, ch, a) { | ||
return deal(str).insert(ch - 1, 'var '); | ||
}, | ||
// TODO: 使用array 字面量 | ||
"Use the array literal notation [].": function () { | ||
return false; | ||
}, | ||
// TODO: 使用array 字面量 | ||
"Use the object literal notation {}.": function () { | ||
return false; | ||
} | ||
}; |
@@ -8,3 +8,3 @@ { | ||
"description": "javascript fix base on jshint", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"main": "./lib/run.js", | ||
@@ -11,0 +11,0 @@ "bin": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
179340
4527