<commit_before>'use strict';

var Backbone = require('backbone');
var Model = require('../models/document');
var PouchDB = require('pouchdb');
var BackbonePouch = require('backbone-pouch');
var _ = require('underscore');

var Documents = Backbone.Collection.extend({
  model: Model,
  sync: BackbonePouch.sync({
    db: new PouchDB('docs'),
    fetch: 'query',
    options: {
      query: {
        include_docs: true,
        fun: {
          map: function(doc){
            emit(doc.position, null);
          }
        },
        limit: 10
      }
    },
    parse: function(result) {
      return _.pluck(result.rows, 'doc');
    }
  })
});

module.exports = Documents;<commit_msg>Adds an explanation for emit in map function for Documents collection<commit_after>'use strict';

var Backbone = require('backbone');
var Model = require('../models/document');
var PouchDB = require('pouchdb');
var BackbonePouch = require('backbone-pouch');
var _ = require('underscore');

var Documents = Backbone.Collection.extend({
  model: Model,
  sync: BackbonePouch.sync({
    db: new PouchDB('docs'),
    fetch: 'query',
    options: {
      query: {
        include_docs: true,
        fun: {
          /* jshint ignore:start */
          // Since it's a scope thing, this isn't undefined;
          // However, jshint still hates it, and rightfully so.
          // So, I'll just ignore it for now :)
          map: function(doc){
            emit(doc.position, null);
          }
          /* jshint ignore:end */
        },
        limit: 10
      }
    },
    parse: function(result) {
      return _.pluck(result.rows, 'doc');
    }
  })
});

module.exports = Documents;
{'fraction_non_alphanumeric': 0.14439784301977232, 'fraction_numerical': 0.002396644697423607, 'mean_word_length': 2.4151329243353783, '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': '2334562', 'n_tokens_mistral': 518, 'n_tokens_neox': 501, 'n_words': 128}