samples/sample-sync-doc-definitions.js
function toDefaultSyncChannels(doc, oldDoc, basePrivilegeName) {
    var businessId = getBusinessId(doc, oldDoc);

    return function(doc, oldDoc) {
      return {
        view: [ toSyncChannel(businessId, 'VIEW_' + basePrivilegeName) ],
        add: [ toSyncChannel(businessId, 'ADD_' + basePrivilegeName) ],
        replace: [ toSyncChannel(businessId, 'CHANGE_' + basePrivilegeName) ],
        remove: [ toSyncChannel(businessId, 'REMOVE_' + basePrivilegeName) ]
      };
    };
  }
function toDefaultSyncChannels(doc, oldDoc, basePrivilegeName) {
    var businessId = getBusinessId(doc, oldDoc);

    return function(doc, oldDoc) {
      return {
        view: [ toSyncChannel(businessId, 'VIEW_' + basePrivilegeName) ],
        add: [ toSyncChannel(businessId, 'ADD_' + basePrivilegeName) ],
        replace: [ toSyncChannel(businessId, 'CHANGE_' + basePrivilegeName) ],
        remove: [ toSyncChannel(businessId, 'REMOVE_' + basePrivilegeName) ]
      };
    };
  }
Builds a function that returns the view, add, replace, remove channels extrapolated from the specified base privilege, name which is formatted according to the de facto Books convention of "VIEW_FOOBAR", "ADD_FOOBAR", "CHANGE_FOOBAR" and "REMOVE_FOOBAR" assuming the base privilege name is "FOOBAR"