refactor
This commit is contained in:
parent
c7f68baec6
commit
176df61343
28
lib/tput.js
28
lib/tput.js
|
@ -1030,7 +1030,7 @@ Tput.prototype.readTermcap = function(data) {
|
|||
|| Tput.termcap;
|
||||
|
||||
var terms = this.parseTermcap(data)
|
||||
, term = terms[this.term];
|
||||
, root = terms[this.term];
|
||||
|
||||
if (this.debug) {
|
||||
this._termcap = terms;
|
||||
|
@ -1038,32 +1038,32 @@ Tput.prototype.readTermcap = function(data) {
|
|||
|
||||
(function tc(term) {
|
||||
if (term && term.strings.tc) {
|
||||
root.inherits = root.inherits || [];
|
||||
root.inherits.push(term.strings.tc);
|
||||
|
||||
if (self.debug && terms[term.strings.tc]) {
|
||||
console.log(term.names.join('/')
|
||||
+ ' inherits from '
|
||||
+ terms[term.strings.tc].names.join('/'));
|
||||
console.log(term.names.join('/') + ' inherits from '
|
||||
+ terms[term.strings.tc].names.join('/'));
|
||||
}
|
||||
|
||||
var t = terms[self.term];
|
||||
t.inherits = t.inherits || [];
|
||||
t.inherits.push(term.strings.tc);
|
||||
if (self.debug) {
|
||||
var names = terms[term.strings.tc]
|
||||
? terms[term.strings.tc].names
|
||||
: [term.strings.tc];
|
||||
console.log(term.names.join('/') + ' inherits from ' + names.join('/'));
|
||||
}
|
||||
|
||||
var inherit = tc(terms[term.strings.tc]);
|
||||
if (inherit) {
|
||||
if (0 && self.debug) {
|
||||
console.log(term.names.join('/')
|
||||
+ ' inherits from '
|
||||
+ inherit.names.join('/'));
|
||||
}
|
||||
['bools', 'numbers', 'strings'].forEach(function(type) {
|
||||
merge(term[type], inherit[type]);
|
||||
});
|
||||
}
|
||||
}
|
||||
return term;
|
||||
})(term);
|
||||
})(root);
|
||||
|
||||
return term;
|
||||
return root;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue