in device/index.js [581:605]
function _updateSubscriptionCache(operation, topics, options) {
var opFunc = null;
//
// Don't cache subscriptions if auto-resubscribe is disabled
//
if (autoResubscribe === false) {
return;
}
if (operation === 'subscribe') {
opFunc = _addToSubscriptionCache;
} else if (operation === 'unsubscribe') {
opFunc = _deleteFromSubscriptionCache;
}
//
// Test to see if 'topics' is an array and if so, iterate.
//
if (Object.prototype.toString.call(topics) === '[object Array]') {
topics.forEach(function(item, index, array) {
opFunc(item, options);
});
} else {
opFunc(topics, options);
}
}