<commit_before>var
  uuid           = require("uuid"),
  bluebird       = require("bluebird"),
  lockNegotiate  = require("./lock-negotiate.js")
;

function MemoryStore () {
  this.store          = {};
}
MemoryStore.prototype     = {

  createTask              : function (task) {
    if (task.id) {
      throw new TypeError("InvalidTaskObject");
    }
    task.id               = uuid.v4();
    this.store[task.id]   = task;

    return bluebird.resolve(task);
  },

  updateTask              : function (task) {
    if(!task.id) {
      throw new TypeError("InvalidTaskObject");
    }
    this.store[task.id]   = task;

    return bluebird.resolve(task);
  },

  getTaskById             : function (id) {
    if(!id) {
      throw new TypeError("TaskIdNotProvided");
    }
    return bluebird.resolve(this.store[id] || null);
  },

  lockTask                : function (id, time_to_live) {
    if(!id) {
      throw new TypeError("TaskIdNotProvided");
    }
    return this.getTaskById(id)
    .then( lockNegotiate.bind(null, time_to_live) )
    .then( this.updateTask.bind(this) );
  }
};
<commit_msg>change function definition spacing<commit_after>var
  uuid           = require("uuid"),
  bluebird       = require("bluebird"),
  lockNegotiate  = require("./lock-negotiate.js")
;

function MemoryStore () {
  this.store  = {};
}
MemoryStore.prototype = {

  createTask: function (task) {
    if (task.id) {
      throw new TypeError("InvalidTaskObject");
    }
    task.id               = uuid.v4();
    this.store[task.id]   = task;

    return bluebird.resolve(task);
  },

  updateTask: function (task) {
    if(!task.id) {
      throw new TypeError("InvalidTaskObject");
    }
    this.store[task.id]   = task;

    return bluebird.resolve(task);
  },

  getTaskById: function (id) {
    if(!id) {
      throw new TypeError("TaskIdNotProvided");
    }
    return bluebird.resolve(this.store[id] || null);
  },

  lockTask: function (id, time_to_live) {
    if(!id) {
      throw new TypeError("TaskIdNotProvided");
    }
    return this.getTaskById(id)
    .then( lockNegotiate.bind(null, time_to_live) )
    .then( this.updateTask.bind(this) );
  }
};

{'fraction_non_alphanumeric': 0.1452358926919519, 'fraction_numerical': 0.0009250693802035153, 'mean_word_length': 2.43879173290938, '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': '4510916', 'n_tokens_mistral': 727, 'n_tokens_neox': 712, 'n_words': 125}