<commit_before>define(function (require) {
  'use strict';

  // foreign modules

  var Backbone = require('backbone');

  // local modules
  var MODEL_STATUS = require('bic/enum-model-status');
  var API = require('bic/api');

  // this module

  /**
   * PendingItem - A BlinkForm that is waiting to be sent to the server.
   * Is stored the users local persistant storage via pouchDB
   */
  var PendingItem = Backbone.Model.extend({
    idAttribute: '_id',

    /**
     * defaults
     * @type {Object}
     */
    defaults: {
      type: 'Form',
      status: MODEL_STATUS.PENDING,
      result: null,
      errors: null,
      name: '',
      action: '',
      data: null,
      answerspaceid: ''
    },

    /**
     * Sends a pending model to the server and then updates the in-memory model with
     * the status from the server
     * @return {Promise} Resolved on successful save, rejected if server returns errors
     */
    process: function () {
      var self = this;

      return new Promise(function (resolve, reject) {
        var processed = function (result) {
          // the listener for this is in view-form-controls.js:325
          // shows popup and then removes the model from the collection.
          self.trigger('processed', self);

          return result;
        };

        var onSuccess = function (data) {
          return self.save({
            status: MODEL_STATUS.SUBMITTED,
            result: data,
            errors: undefined // remove any errors for a previously saved pending model.
          }).then(processed)
            .then(resolve)
            .then(undefined, reject);
        };

        var onFailure = function (data, status, errorName) {
          var err = { message: errorName };
          if (status === 'error' && data.responseText) {
            try {
              err = JSON.parse(data.responseText);
            } catch(e) {
              /* eslint-disable no-unused-expressions */
              window.console && window.console.log('Pending model: unable to parse response from server');
              /* eslint-enable no-unused-expressions */
            }

            self.setErrors(err)
                .then(processed)
                .then(undefined, processed);
          }

          reject(new Error(err.message));
        };<commit_msg>(chore) ESLint: fix a missing space after `catch`<commit_after>define(function (require) {
  'use strict';

  // foreign modules

  var Backbone = require('backbone');

  // local modules
  var MODEL_STATUS = require('bic/enum-model-status');
  var API = require('bic/api');

  // this module

  /**
   * PendingItem - A BlinkForm that is waiting to be sent to the server.
   * Is stored the users local persistant storage via pouchDB
   */
  var PendingItem = Backbone.Model.extend({
    idAttribute: '_id',

    /**
     * defaults
     * @type {Object}
     */
    defaults: {
      type: 'Form',
      status: MODEL_STATUS.PENDING,
      result: null,
      errors: null,
      name: '',
      action: '',
      data: null,
      answerspaceid: ''
    },

    /**
     * Sends a pending model to the server and then updates the in-memory model with
     * the status from the server
     * @return {Promise} Resolved on successful save, rejected if server returns errors
     */
    process: function () {
      var self = this;

      return new Promise(function (resolve, reject) {
        var processed = function (result) {
          // the listener for this is in view-form-controls.js:325
          // shows popup and then removes the model from the collection.
          self.trigger('processed', self);

          return result;
        };

        var onSuccess = function (data) {
          return self.save({
            status: MODEL_STATUS.SUBMITTED,
            result: data,
            errors: undefined // remove any errors for a previously saved pending model.
          }).then(processed)
            .then(resolve)
            .then(undefined, reject);
        };

        var onFailure = function (data, status, errorName) {
          var err = { message: errorName };
          if (status === 'error' && data.responseText) {
            try {
              err = JSON.parse(data.responseText);
            } catch (e) {
              /* eslint-disable no-unused-expressions */
              window.console && window.console.log('Pending model: unable to parse response from server');
              /* eslint-enable no-unused-expressions */
            }

            self.setErrors(err)
                .then(processed)
                .then(undefined, processed);
          }

          reject(new Error(err.message));
        };
{'fraction_non_alphanumeric': 0.10844919786096256, 'fraction_numerical': 0.0012834224598930481, 'mean_word_length': 1.8704726826273788, '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': '6167392', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1228, 'n_words': 386}