1 /**
  2  * @namespace
  3  */
  4 jasmine.util = {};
  5 
  6 /**
  7  * Declare that a child class inherite it's prototype from the parent class.
  8  *
  9  * @private
 10  * @param {Function} childClass
 11  * @param {Function} parentClass
 12  */
 13 jasmine.util.inherit = function(childClass, parentClass) {
 14   var subclass = function() {
 15   };
 16   subclass.prototype = parentClass.prototype;
 17   childClass.prototype = new subclass;
 18 };
 19 
 20 jasmine.util.formatException = function(e) {
 21   var lineNumber;
 22   if (e.line) {
 23     lineNumber = e.line;
 24   }
 25   else if (e.lineNumber) {
 26     lineNumber = e.lineNumber;
 27   }
 28 
 29   var file;
 30 
 31   if (e.sourceURL) {
 32     file = e.sourceURL;
 33   }
 34   else if (e.fileName) {
 35     file = e.fileName;
 36   }
 37 
 38   var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();
 39 
 40   if (file && lineNumber) {
 41     message += ' in ' + file + ' (line ' + lineNumber + ')';
 42   }
 43 
 44   return message;
 45 };
 46 
 47 jasmine.util.htmlEscape = function(str) {
 48   if (!str) return str;
 49   return str.replace(/&/g, '&')
 50     .replace(/</g, '<')
 51     .replace(/>/g, '>');
 52 };
 53 
 54 jasmine.util.argsToArray = function(args) {
 55   var arrayOfArgs = [];
 56   for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
 57   return arrayOfArgs;
 58 };
 59 
 60