From 0b74818ba503207595d56fa91c70ba3e83a481af Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Tue, 20 Jul 2010 12:22:10 +0200 Subject: Add util.getObjectKeys for better diagnostic. --- lib/util.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/util.js b/lib/util.js index 4648ee9..4f3964e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -1,4 +1,4 @@ -/*global exports: false, require: false, console: false */ +/*global exports: false, require: false, console: false, Cc: false, Ci: false */ /*jslint onevar: false */ // Released under the MIT/X11 license // http://www.opensource.org/licenses/mit-license.php @@ -28,12 +28,11 @@ var {Cc,Ci} = require("chrome"); * */ exports.heir = function heir(p) { - function f() {}; - f.prototype = p.prototype; - return new f(); + function F() {}; + F.prototype = p.prototype; + return new F(); }; - exports.getBugNo = function getBugNo(url) { var re = new RegExp(".*id=([0-9]+).*$"); var bugNo = null; @@ -187,3 +186,13 @@ var filterByRegexp = exports.filterByRegexp = return ""; } }; + +exports.getObjectKeys = function getObjectKeys(obj) { + var keys = []; + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + keys.push(key); + } + } + return keys; +}; \ No newline at end of file -- cgit