util: convert inspect.styles and inspect.colors to prototype-less obj… · nodejs/node@aab0d20

Original file line numberDiff line numberDiff line change

@@ -166,7 +166,7 @@ Object.defineProperty(inspect, 'defaultOptions', {

166166

});

167167
168168

// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics

169-

inspect.colors = {

169+

inspect.colors = Object.assign(Object.create(null), {

170170

'bold': [1, 22],

171171

'italic': [3, 23],

172172

'underline': [4, 24],

@@ -180,10 +180,10 @@ inspect.colors = {

180180

'magenta': [35, 39],

181181

'red': [31, 39],

182182

'yellow': [33, 39]

183-

};

183+

});

184184
185185

// Don't use 'blue' not visible on cmd.exe

186-

inspect.styles = {

186+

inspect.styles = Object.assign(Object.create(null), {

187187

'special': 'cyan',

188188

'number': 'yellow',

189189

'boolean': 'yellow',

@@ -194,7 +194,7 @@ inspect.styles = {

194194

'date': 'magenta',

195195

// "name": intentionally not styling

196196

'regexp': 'red'

197-

};

197+

});

198198
199199

const customInspectSymbol = internalUtil.customInspectSymbol;

200200