Skip to content

Instantly share code, notes, and snippets.

@tmpvar
Created February 9, 2010 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmpvar/298927 to your computer and use it in GitHub Desktop.
Save tmpvar/298927 to your computer and use it in GitHub Desktop.
// base.js
var base = function() {
};
base.prototype = {
};
exports.base = base;
// test.js
var base = require("./base").base,
sys = require("sys");
sys.puts(base.prototype);
base.prototype.test = function() {
return "yes."
};
var t = new base();
sys.puts(t.test());
/*
tmpvar@tmpvar:/tmp$ node test.js
undefined
TypeError: Cannot set property 'test' of undefined
at Object.<anonymous> (/tmp/test.js:6:21)
at [object Object].<anonymous> (node.js:938:23)
at [object Object].emitSuccess (node.js:241:15)
at [object Object].<anonymous> (node.js:655:21)
at [object Object].emitSuccess (node.js:241:15)
at node.js:511:29
at node.js:995:9
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment