Sha256: 6eb5644f52d5846c56e7b8aa94321ed8306c6a87e70241adaa750b6302f29403

Contents?: true

Size: 546 Bytes

Versions: 3

Compression:

Stored size: 546 Bytes

Contents

JsUnitTest.Unit.MessageTemplate = function(string) {
  var parts = [];
  var str = JsUnitTest.scan((string || ''), /(?=[^\\])\?|(?:\\\?|[^\?])+/, function(part) {
    parts.push(part[0]);
  });
  this.parts = parts;
};

JsUnitTest.Unit.MessageTemplate.prototype.evaluate = function(params) {
  var results = [];
  for (var i=0; i < this.parts.length; i++) {
    var part = this.parts[i];
    var result = (part == '?') ? JsUnitTest.inspect(params.shift()) : part.replace(/\\\?/, '?');
    results.push(result);
  };
  return results.join('');
};

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newjs-1.7.0 vendor/jsunittest/src/message_template.js
newjs-1.7.1 vendor/jsunittest/src/message_template.js
newjs-1.7.2 vendor/jsunittest/src/message_template.js