From fb47330e20fa9bdde149d157aee7b043e421df9e Mon Sep 17 00:00:00 2001 From: jos Date: Mon, 16 Mar 2015 10:06:50 +0100 Subject: [PATCH 1/3] Removed redundant `main` function from jsonlint.js. --- .gitignore | 1 + lib/jsonlint.js | 18 ++---------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 3c3629e..34977ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +.idea \ No newline at end of file diff --git a/lib/jsonlint.js b/lib/jsonlint.js index 598c18c..d0f05f9 100644 --- a/lib/jsonlint.js +++ b/lib/jsonlint.js @@ -413,20 +413,6 @@ parser.lexer = lexer; return parser; })(); if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = jsonlint; -exports.parse = function () { return jsonlint.parse.apply(jsonlint, arguments); } -exports.main = function commonjsMain(args) { - if (!args[1]) - throw new Error('Usage: '+args[0]+' FILE'); - if (typeof process !== 'undefined') { - var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); - } else { - var cwd = require("file").path(require("file").cwd()); - var source = cwd.join(args[1]).read({charset: "utf-8"}); - } - return exports.parser.parse(source); -} -if (typeof module !== 'undefined' && require.main === module) { - exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); -} + exports.parser = jsonlint; + exports.parse = jsonlint.parse; } \ No newline at end of file From c9ebd82b7e3c855f7220198451e74f1d84c8c653 Mon Sep 17 00:00:00 2001 From: jos Date: Thu, 7 May 2015 11:37:46 +0200 Subject: [PATCH 2/3] Fixed a binding issue using `jsonlint.parse` --- lib/jsonlint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jsonlint.js b/lib/jsonlint.js index d0f05f9..174814b 100644 --- a/lib/jsonlint.js +++ b/lib/jsonlint.js @@ -414,5 +414,5 @@ return parser; })(); if (typeof require !== 'undefined' && typeof exports !== 'undefined') { exports.parser = jsonlint; - exports.parse = jsonlint.parse; + exports.parse = jsonlint.parse.bind(this); } \ No newline at end of file From 85a19d77126771f3177582e3d09c6ffae185d391 Mon Sep 17 00:00:00 2001 From: jos Date: Thu, 7 May 2015 11:44:09 +0200 Subject: [PATCH 3/3] Fixed a binding issue using `jsonlint.parse` for real now --- lib/jsonlint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jsonlint.js b/lib/jsonlint.js index 174814b..ae9b2f4 100644 --- a/lib/jsonlint.js +++ b/lib/jsonlint.js @@ -414,5 +414,5 @@ return parser; })(); if (typeof require !== 'undefined' && typeof exports !== 'undefined') { exports.parser = jsonlint; - exports.parse = jsonlint.parse.bind(this); + exports.parse = jsonlint.parse.bind(jsonlint); } \ No newline at end of file