text: function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  var Social = function () {
    function Social() {
      _classCallCheck(this, Social);
    }
  
    Social.prototype.groupGet = function groupGet(path, callback) {
      var groupNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : State.local.get('groups').get('follows');
  
      var follows = {};
      groupNode.map(function (isFollowing, user) {
        if (follows[user] && follows[user] === isFollowing) {
          return;
        }
        follows[user] = isFollowing;
        if (isFollowing) {
          // TODO: callback on unfollow, for unsubscribe
          var node = _.reduce(path.split('/'), function (sum, s) {
            return sum.get(decodeURIComponent(s));
          }, State.public.user(user));
          callback(node, user);
        }
      });
    };
  
    Social.prototype.groupMap = function groupMap(path, callback) {
      var groupNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : State.local.get('groups').get('follows');
  
      groupGet(path, function (node, from) {
        return node.map(function () {
          for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
  
          return callback.apply(undefined, args.concat([from]));
        });
      }, groupNode);
    };
  
    Social.prototype.groupOn = function groupOn(path, callback) {
      var groupNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : State.local.get('groups').get('follows');
  
      groupGet(path, function (node, from) {
        return node.on(function () {
          for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
            args[_key2] = arguments[_key2];
          }
  
          return callback.apply(undefined, args.concat([from]));
        });
      }, groupNode);
    };
  
    return Social;
  }();
  
  export default Social;