Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Update lib/cli-table/utils.js #18

Merged
merged 1 commit into from Sep 19, 2012
Jump to file or symbol
Failed to load files and symbols.
+11 −10
Split
View
@@ -1,4 +1,3 @@
-
/**
* Repeats a string.
*
@@ -72,17 +71,19 @@ function clone(a){
return a;
};
-exports.options = function (defaults, opts){
- if (!opts) opts = {};
-
- var c = clone(opts);
- for (var i in defaults)
- if (!(i in opts))
- c[i] = defaults[i];
- return c;
+exports.options = function(defaults, opts) {
+ var c, i, _i, _len, _results;
+ c = clone(opts);
+ _results = [];
+ for (_i = 0, _len = defaults.length; _i < _len; _i++) {
+ i = defaults[_i];
+ if (i && [].__indexOf.call(opts, i) >= 0) {
+ _results.push(c[_i] = i);
+ }
+ }
+ return _results;
};
-
//
// For consideration of terminal "color" programs like colors.js,
// which can add ANSI escape color codes to strings,