Sha256: 14e957a506f79e74238ca12f16d0bc8bb95e2c339e27911f12abb7011bb5dc3c

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 KB

Contents

/**
 * @namespace
 */
jasmine.util = {};

/**
 * Declare that a child class inherit it's prototype from the parent class.
 *
 * @private
 * @param {Function} childClass
 * @param {Function} parentClass
 */
jasmine.util.inherit = function(childClass, parentClass) {
  /**
   * @private
   */
  var subclass = function() {
  };
  subclass.prototype = parentClass.prototype;
  childClass.prototype = new subclass();
};

jasmine.util.formatException = function(e) {
  var lineNumber;
  if (e.line) {
    lineNumber = e.line;
  }
  else if (e.lineNumber) {
    lineNumber = e.lineNumber;
  }

  var file;

  if (e.sourceURL) {
    file = e.sourceURL;
  }
  else if (e.fileName) {
    file = e.fileName;
  }

  var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();

  if (file && lineNumber) {
    message += ' in ' + file + ' (line ' + lineNumber + ')';
  }

  return message;
};

jasmine.util.htmlEscape = function(str) {
  if (!str) return str;
  return str.replace(/&/g, '&')
    .replace(/</g, '&lt;')
    .replace(/>/g, '&gt;');
};

jasmine.util.argsToArray = function(args) {
  var arrayOfArgs = [];
  for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
  return arrayOfArgs;
};

jasmine.util.extend = function(destination, source) {
  for (var property in source) destination[property] = source[property];
  return destination;
};

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
evergreen-1.3.0 lib/jasmine/src/core/util.js
evergreen-1.2.0 lib/jasmine/src/core/util.js
evergreen-1.1.3 lib/jasmine/src/core/util.js
evergreen-1.1.2 lib/jasmine/src/core/util.js
evergreen-1.1.0 lib/jasmine/src/core/util.js
evergreen-1.0.1 lib/jasmine/src/core/util.js
evergreen-1.0.0 lib/jasmine/src/core/util.js
josephholsten-jasmine-1.1.0.pre.10 jasmine/src/util.js
jasmine-1.0.2.1 jasmine/src/util.js
josephholsten-jasmine-1.1.0.pre.1 jasmine/src/util.js