code: function invalidIdError(id) {
    var err;
    if (!id) {
      err = pouchdbErrors.createError(pouchdbErrors.MISSING_ID);
    } else if (typeof id !== 'string') {
      err = pouchdbErrors.createError(pouchdbErrors.INVALID_ID);
    } else if (/^_/.test(id) && !(/^_(design|local)/).test(id)) {
      err = pouchdbErrors.createError(pouchdbErrors.RESERVED_ID);
    }
    if (err) {
      throw err;
    }
  }
docs: Determine id an ID is valid - invalid IDs begin with an underescore that does not begin '_design' or '_local' - any other string value is a valid id Returns the specific error object for each case