inherit tput objects properties.

This commit is contained in:
Christopher Jeffrey 2013-02-27 12:22:31 -06:00
parent f7e8cde45e
commit 983dfa943e

View File

@ -54,11 +54,10 @@ function Program(options) {
Program.prototype.__proto__ = EventEmitter.prototype; Program.prototype.__proto__ = EventEmitter.prototype;
Program.prototype.setupTput = function(is) { Program.prototype.setupTput = function() {
var self = this var self = this
, options = this.options; , options = this.options
, write = this.write.bind(this);
var write = this.write.bind(this);
var tput = this.tput = new Tput({ var tput = this.tput = new Tput({
term: this.terminal, term: this.terminal,
@ -76,6 +75,11 @@ Program.prototype.setupTput = function(is) {
} }
}; };
Object.keys(tput).forEach(function(key) {
if (self[key] != null) return;
self[key] = tput[key];
});
Object.keys(tput).forEach(function(key) { Object.keys(tput).forEach(function(key) {
if (typeof tput[key] !== 'function') { if (typeof tput[key] !== 'function') {
self.put[key] = tput[key]; self.put[key] = tput[key];