<commit_before>Accounts.registerLoginHandler("anonymous", function (options) {
    if (! options || ! options.anonymous || Meteor.userId())
        return undefined;

    var newUserId = Accounts.insertUserDoc(options, {});
    return {
        userId: newUserId
    };
});

AccountsAnonymous._onAbandonedHook = new Hook({
  bindEnvironment: false,
  debugPrintExceptions: "AccountsAnonymous.onAbandoned callback"
});

AccountsAnonymous.onAbandoned = function (func) {
  var self = this;
  return self._onAbandonedHook.register(func);
};

AccountsMultiple.register({
  onSwitch: function (attemptingUser, attempt) {
    if (isGuest(attemptingUser)) {
      AccountsAnonymous._onAbandonedHook.each(function (callback) {
          callback(attemptingUser);
          return true;
      });
    }
  }
});

var isGuest = function(user) {
  // A user is a guest if they don't have any services other than "resume"
  return (user.services && _.size(user.services) === 1 && user.services.resume);
};<commit_msg>Rename isGuest to isAnonymous.<commit_after>Accounts.registerLoginHandler("anonymous", function (options) {
    if (! options || ! options.anonymous || Meteor.userId())
        return undefined;

    var newUserId = Accounts.insertUserDoc(options, {});
    return {
        userId: newUserId
    };
});

AccountsAnonymous._onAbandonedHook = new Hook({
  bindEnvironment: false,
  debugPrintExceptions: "AccountsAnonymous.onAbandoned callback"
});

AccountsAnonymous.onAbandoned = function (func) {
  var self = this;
  return self._onAbandonedHook.register(func);
};

AccountsMultiple.register({
  onSwitch: function (attemptingUser, attempt) {
    if (isAnonymous(attemptingUser)) {
      AccountsAnonymous._onAbandonedHook.each(function (callback) {
          callback(attemptingUser);
          return true;
      });
    }
  }
});

function isAnonymous(user) {
  // A user is anonymous if they don't have any services other than "resume"
  return (user.services && _.size(user.services) === 1 && user.services.resume);
}
{'fraction_non_alphanumeric': 0.1227810650887574, 'fraction_numerical': 0.0009861932938856016, 'mean_word_length': 3.9009661835748792, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1525883', 'n_tokens_mistral': 618, 'n_tokens_neox': 601, 'n_words': 131}