Comparing version 0.1.2 to 0.1.3
@@ -107,3 +107,23 @@ function Deal(str) { | ||
return deal(str).insert(ch, '\\\\'); | ||
}, | ||
// 把表达式换成条件语句。 | ||
"Expected an assignment or function call and instead saw an expression.": function (str, ch) { | ||
var statement = str.slice(str.search(/\S/), ch + 1), | ||
newStr = '', | ||
arr, last; | ||
// TODO: 三元表达式的暂不处理 | ||
if (statement.indexOf('?') !== -1 && statement.indexOf(':') !== -1) { | ||
return false; | ||
} | ||
arr = statement.split(/\s*\&\&\s*/); | ||
last = arr.pop(); | ||
if (arr.length > 0) { | ||
newStr = 'if (' + arr.join(' && ') + ') { ' + last + ' }'; | ||
} | ||
return newStr ? deal(str).update(0, statement, newStr) : false; | ||
}, | ||
// 添加逗号后自动修复 | ||
"Line breaking error 'return'.": function (str, ch) { | ||
return str; | ||
} | ||
}; |
@@ -88,3 +88,3 @@ #!/usr/bin/env node | ||
args = [ | ||
codes[idx], ch, result.a, result.b, result.c, result.d | ||
codes[idx], ch, result.a, result.b, result.c, result.d, evi | ||
], | ||
@@ -168,3 +168,3 @@ fixedResult; | ||
var path = (process.argv[2] || '').replace(/\/$/, ''), | ||
filterArray = [].concat(process.argv[3].split(',') || []); | ||
filterArray = [].concat((process.argv[3] && process.argv[3].split(',')) || []); | ||
if (path) { | ||
@@ -171,0 +171,0 @@ indexs(filterArray); |
@@ -8,3 +8,3 @@ { | ||
"description": "javascript fix base on jshint", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"main": "./lib/run.js", | ||
@@ -11,0 +11,0 @@ "bin": { |
@@ -20,2 +20,3 @@ ##Usage | ||
* Add radix parameter for parseInt. | ||
* Escape something unescaped. | ||
* Escape something unescaped. | ||
* Use if statment instead of an expression. |
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
178724
4503
21