Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Feb 21, 2018
1 parent b5aa3dd commit e8ece8b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,26 @@ function setupMethods (soljson) {
}

var compile = function (input, optimise, readCallback) {
// NOTE: horribly inefficient
if (typeof input === 'string') {
var isStandardJSON = false;
try {
input = JSON.parse(input);
if (typeof input['language'] === 'string') {
isStandardJSON = true;
}
} catch (e) {
}

if (isStandardJSON) {
// NOTE: takes second argument as "readCallback"
return JSON.parse(compileStandardWrapper(input, optimise));
}
}

if (typeof input !== 'string' && typeof input['language'] === 'string') {
// NOTE: takes second argument as "readCallback"
return compileStandardWrapper(input, optimise);
return JSON.parse(compileStandardWrapper(JSON.stringify(input), optimise));
}

var result = '';
Expand Down

0 comments on commit e8ece8b

Please sign in to comment.