code: function(attrs, options) {
          var error;
  
          var username = (attrs && attrs.username) || this.get('username');
          if (!username || username === '') {
            error = new AVError(
              AVError.OTHER_CAUSE,
              'Cannot sign up user with an empty name.'
            );
            throw error;
          }
  
          var password = (attrs && attrs.password) || this.get('password');
          if (!password || password === '') {
            error = new AVError(
              AVError.OTHER_CAUSE,
              'Cannot sign up user with an empty password.'
            );
            throw error;
          }
  
          return this.save(attrs, options).then(function(model) {
            if (model.isAnonymous()) {
              model.unset(`authData.${PLATFORM_ANONYMOUS}`);
              model._opSetQueue = [{}];
            }
            return model._handleSaveResult(true).then(function() {
              return model;
            });
          });
        }
docs: Signs up a new user. You should call this instead of save for
  new AV.Users. This will create a new AV.User on the server, and
  also persist the session on disk so that you can access the user using
  <code>current</code>.
  
  <p>A username and password must be set before calling signUp.</p>
  
  @param {Object} attrs Extra fields to set on the new user, or null.
  @param {AuthOptions} options
  @return {Promise} A promise that is fulfilled when the signup
  finishes.
  @see AV.User.signUp