// Generated by CoffeeScript 1.4.0

/* global: Handlebars
*/


(function() {

  this.uuid = function() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
      var r, v;
      r = Math.random() * 16 | 0;
      v = c === 'x' ? r : r & 0x3 | 0x8;
      return v.toString(16);
    });
  };

  this.to_hash = function(pairs) {
    var hash, key, value, _i, _len, _ref;
    hash = {};
    for (_i = 0, _len = pairs.length; _i < _len; _i++) {
      _ref = pairs[_i], key = _ref[0], value = _ref[1];
      hash[key] = value;
    }
    return hash;
  };

  Handlebars.registerHelper('if_eq', function(context, options) {
    if (context === options.hash.compare) {
      return options.fn(this);
    }
    return options.inverse(this);
  });

}).call(this);
