function defineProperty(key, protoKey) {
// Check arity
+ var fn = proto[protoKey].bind(self);
+
if (proto[protoKey].length === 0) {
Object.defineProperty(self.repl.context, key, {
- get: proto[protoKey].bind(self),
- enumerable: true
+ get: fn,
+ enumerable: true,
+ configurable: false
});
} else {
- self.repl.context[key] = proto[protoKey].bind(self);
+ self.repl.context[key] = fn;
}
};
};
// List source code
-Interface.prototype.list = function() {
+Interface.prototype.list = function(delta) {
if (!this.requireConnection()) return;
+ delta || (delta = 5);
+
var self = this,
client = this.client,
- delta = arguments[0] || 5,
from = client.currentSourceLine - delta + 1,
to = client.currentSourceLine + delta + 1;