commit
01b761c698
@ -1,23 +1,29 @@ |
||||
function setupMethods (soljson){ |
||||
|
||||
var soljson = require('./bin/soljson-latest.js'); |
||||
|
||||
var compileJSON = soljson.cwrap("compileJSON", "string", ["string", "number"]); |
||||
var compileJSONMulti = |
||||
var compileJSON = soljson.cwrap("compileJSON", "string", ["string", "number"]); |
||||
var compileJSONMulti = |
||||
'_compileJSONMulti' in soljson ? |
||||
soljson.cwrap("compileJSONMulti", "string", ["string", "number"]) : |
||||
null; |
||||
|
||||
var compile = function(input, optimise) { |
||||
var compile = function(input, optimise) { |
||||
var result = ''; |
||||
if (typeof(input) != typeof('') && compileJSONMulti !== null) |
||||
result = compileJSONMulti(JSON.stringify(input), optimise); |
||||
else |
||||
result = compileJSON(input, optimise); |
||||
return JSON.parse(result); |
||||
} |
||||
} |
||||
|
||||
var version = soljson.cwrap("version", "string", []); |
||||
|
||||
module.exports = { |
||||
return { |
||||
version: version, |
||||
compile: compile, |
||||
version: soljson.cwrap("version", "string", []) |
||||
useVersion: function( versionString ){ |
||||
return setupMethods( require('./bin/soljson-' + versionString + '.js' ) ); |
||||
} |
||||
} |
||||
} |
||||
|
||||
module.exports = setupMethods( require('./bin/soljson-latest.js') ); |
||||
|
Loading…
Reference in new issue