Sha256: 62b9bdefd12b7c36f2b4dc15318e434670036f6d6e5b396b4d06122320928306

Contents?: true

Size: 806 Bytes

Versions: 1

Compression:

Stored size: 806 Bytes

Contents

(function($) {
  $.print = function(obj) {
    if (obj instanceof Function) {
      return obj.toString().match(/^([^\{]*) {/)[1];
    } else if(obj instanceof Array) {
      var result = [];
      for (var i = 0; i < obj.length; i++) {
        result.push($.print(obj[i]));
      }
      return "[" + result.join(", ") + "]";
    } else if(obj instanceof HTMLElement) {
      return "<" + obj.tagName + " " + (obj.className != "" ? "class='" + obj.className + "'" : "") +
        (obj.id != "" ? "id='" + obj.id + "'" : "") + ">";
    } else if(obj instanceof Object) {
      var result = [];
      for (var k in obj) {
        result.push(k + ": " + $.print(obj[k]))
      }
      return "{" + result.join(", ") + "}" 
    } else {
      return obj.toString().replace(/\n\s*/g, "");
    }
  }
})(jQuery);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
btakita-screw_unit-0.1.0 core/lib/jquery.print.js