From c08e916b62667c9f254b4971699db2c13695546c Mon Sep 17 00:00:00 2001 From: Gabriel Adomnicai Date: Mon, 3 Dec 2012 13:25:58 -0800 Subject: [PATCH 1/5] sort object keys when printing --- lib/eyes.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/eyes.js b/lib/eyes.js index 10d964b..7c0aedd 100644 --- a/lib/eyes.js +++ b/lib/eyes.js @@ -178,6 +178,7 @@ function stringifyObject(obj, options, level) { var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj); + keys = keys.sort(); keys.forEach(function (k) { if (Object.prototype.hasOwnProperty.call(obj, k) && !(obj[k] instanceof Function && options.hideFunctions)) { From 78250c40d72fdb4947d018c68dd423fdbad02cdc Mon Sep 17 00:00:00 2001 From: Gabriel Adomnicai Date: Thu, 6 Dec 2012 18:06:33 -0800 Subject: [PATCH 2/5] version update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc40240..471f97f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "contributors" : [{ "name": "Charlie Robbins", "email": "charlie@nodejitsu.com" }], "licenses" : ["MIT"], "main" : "./lib/eyes", - "version" : "0.1.8", + "version" : "0.1.8cust", "scripts" : { "test": "node test/*-test.js" }, "directories" : { "lib": "./lib", "test": "./test" }, "engines" : { "node": "> 0.1.90" } From c0edebb9d2bbd106a21b5f0358aac01dce298de4 Mon Sep 17 00:00:00 2001 From: Gabriel Adomnicai Date: Thu, 6 Dec 2012 19:03:54 -0800 Subject: [PATCH 3/5] Revert "version update" This reverts commit 78250c40d72fdb4947d018c68dd423fdbad02cdc. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 471f97f..bc40240 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "contributors" : [{ "name": "Charlie Robbins", "email": "charlie@nodejitsu.com" }], "licenses" : ["MIT"], "main" : "./lib/eyes", - "version" : "0.1.8cust", + "version" : "0.1.8", "scripts" : { "test": "node test/*-test.js" }, "directories" : { "lib": "./lib", "test": "./test" }, "engines" : { "node": "> 0.1.90" } From 05f06b7bb2e349e70c247a0447ae97b3c4617adc Mon Sep 17 00:00:00 2001 From: Gabriel Adomnicai Date: Mon, 22 Apr 2013 14:26:48 -0700 Subject: [PATCH 4/5] made sort object keys configurable --- README.md | 1 + lib/eyes.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c4f6f76..a8a2271 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ These are the default styles and settings used by _eyes_. }, pretty: true, // Indent object literals + sortObjectKeys: false // Sort object keys hideFunctions: false, // Don't output functions at all stream: process.stdout, // Stream to write to, or null maxLength: 2048 // Truncate output if longer diff --git a/lib/eyes.js b/lib/eyes.js index 7c0aedd..e14676b 100644 --- a/lib/eyes.js +++ b/lib/eyes.js @@ -27,6 +27,7 @@ eyes.defaults = { regexp: 'green', // /\d+/ }, pretty: true, // Indent object literals + sortObjectKeys: false, // Sort object keys hideFunctions: false, showHidden: false, stream: process.stdout, @@ -178,7 +179,9 @@ function stringifyObject(obj, options, level) { var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj); - keys = keys.sort(); + if (options.sortObjectKeys) { + keys = keys.sort(); + } keys.forEach(function (k) { if (Object.prototype.hasOwnProperty.call(obj, k) && !(obj[k] instanceof Function && options.hideFunctions)) { From 22db2b02adc6d58157c3b472fdceb039d4cb11c5 Mon Sep 17 00:00:00 2001 From: Gabriel Adomnicai Date: Mon, 22 Apr 2013 14:28:26 -0700 Subject: [PATCH 5/5] readme fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8a2271..b5d050e 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ These are the default styles and settings used by _eyes_. }, pretty: true, // Indent object literals - sortObjectKeys: false // Sort object keys + sortObjectKeys: false, // Sort object keys hideFunctions: false, // Don't output functions at all stream: process.stdout, // Stream to write to, or null maxLength: 2048 // Truncate output if longer