Skip to content

Commit e285e11

Browse files
committed
style: Improvements
1 parent 50dc1fe commit e285e11

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

bare.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ var d = require("d")
99
, memoize = require("memoizee")
1010
, memoizeMethods = require("memoizee/methods")
1111
, sgr = require("./lib/sgr")
12-
, mods = sgr.mods
12+
, supportsColor = require("./lib/supports-color");
13+
14+
var mods = sgr.mods
1315
, join = Array.prototype.join
1416
, defineProperty = Object.defineProperty
1517
, max = Math.max
1618
, min = Math.min
1719
, variantModes = primitiveSet("_fg", "_bg")
18-
, supportsColor = require("./lib/supports-color")
19-
, xtermMatch
20-
, getFn;
20+
, xtermMatch = process.platform === "win32" ? require("./lib/xterm-match") : null;
21+
22+
var getFn;
2123

2224
// Some use cli-color as: console.log(clc.red('Error!'));
2325
// Which is inefficient as on each call it configures new clc object
@@ -64,8 +66,6 @@ var getEndRe = memoize(function (code) { return new RegExp("\x1b\\[" + code + "m
6466
primitive: true
6567
});
6668

67-
if (process.platform === "win32") xtermMatch = require("./lib/xterm-match");
68-
6969
getFn = function () {
7070
return setPrototypeOf(
7171
function self(/* …msg*/) {
@@ -86,9 +86,7 @@ getFn = function () {
8686
null,
8787
true
8888
);
89-
if (!supportsColor.isColorSupported()) {
90-
return msg;
91-
}
89+
if (!supportsColor.isColorSupported()) return msg;
9290
return start + msg + end;
9391
},
9492
proto

0 commit comments

Comments
 (0)