Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsfix

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsfix - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

20

lib/map.js

@@ -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;
}
};

4

lib/run.js

@@ -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.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc