JASON
JASON copied to clipboard
ReferenceError: require is not defined
var obj = {
fn: function(url, cb) {
require('http').get({
host: url
}, cb);
}
};
var str = JASON.stringify(obj);
console.log(str);
var newobj = JASON.parse(str);
yields
{"fn":(function (url, cb) {
require('http').get({
host: url
}, cb);
})}
undefined:2
require('http').get({
^
ReferenceError: require is not defined
at eval at parse (/home/codex/apps/thread/node_modules/JASON/index.js:276:12)
I read the README section about this and it says items in the global scope (like require) should work. Am I doing something wrong here?