Skip to content

Instantly share code, notes, and snippets.

@cjc
Created May 24, 2011 07:05
Show Gist options
  • Save cjc/988243 to your computer and use it in GitHub Desktop.
Save cjc/988243 to your computer and use it in GitHub Desktop.
$ node test.js
cjcbufferprotoprop
cjcstringprotoprop
cjcdateprotoprop
$ node
> require('./proto')
{}
> new Buffer(1).cjc
'cjcbufferprotoprop'
> new String('1').cjc
> new Date().cjc
> String.prototype.__defineGetter__('cjc',function() {return 'cjcstringprotoprop';});
{ cjc: [Getter] }
> new String('1').cjc
'cjcstringprotoprop'
> Date.prototype.__defineGetter__('cjc', function() {return 'cjcdateprotoprop';});
{ cjc: [Getter] }
> new Date().cjc
'cjcdateprotoprop'
>
String.prototype.__defineGetter__('cjc',function() {return 'cjcstringprotoprop';});
Buffer.prototype.__defineGetter__('cjc', function() {return 'cjcbufferprotoprop';});
Date.prototype.__defineGetter__('cjc', function() {return 'cjcdateprotoprop';});
var sys = require('sys');
require('./proto');
sys.puts(new Buffer(1).cjc);
sys.puts(new String('1').cjc);
sys.puts(new Date().cjc);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment