diff --git a/.gitignore b/.gitignore index af4175f..6f3c2ec 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ lib-cov *.pid *.gz .*.swp +.idea node_modules pids diff --git a/.travis.yml b/.travis.yml index 05d299e..9cbeadb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: node_js node_js: - - "0.10" - - "0.11" + - "node" + - "lts/*" + - "9" + - "8" + - "6" \ No newline at end of file diff --git a/index.js b/index.js index 4757600..3c9e4c7 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,18 @@ var json_stringify = require('./lib/stringify.js').stringify; var json_parse = require('./lib/parse.js'); -module.exports = function(options) { +var newInstance = function(options) { return { parse: json_parse(options), stringify: json_stringify } }; + +module.exports = newInstance; + //create the default method members with no options applied for backwards compatibility module.exports.parse = json_parse(); module.exports.stringify = json_stringify; + +// for cleaner typescript API +module.exports.newInstance = newInstance; diff --git a/package.json b/package.json index 6c3feba..ab884e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "json-bigint", - "version": "0.3.0", + "version": "0.3.1", "description": "JSON.parse with bigints support", "main": "index.js", "scripts": {