// Returns primitive { ownerId: sortIndexValue } map for provided sortKeyPath

'use strict';

var ensureString = require('es5-ext/object/validate-stringifiable-value')
  , ee           = require('event-emitter')
  , memoize      = require('memoizee')
  , dbDriver     = require('mano').dbDriver;

module.exports = memoize(function (storageName, sortKeyPath) {
	var itemsMap = ee();
	dbDriver.getStorage(storageName).on('key:' + (sortKeyPath + '&'), function (event) {
		if (!itemsMap[event.ownerId]) {
			itemsMap[event.ownerId] = { id: event.ownerId, stamp: event.data.stamp };
		} else {
			itemsMap[event.ownerId].stamp = event.data.stamp;
		}
		itemsMap.emit('update', event);
	});
	return itemsMap;
}, { primitive: true, resolvers: [ensureString, function (sortKeyPath) {
	return (sortKeyPath == null) ? '' : String(sortKeyPath);
}] });

@@ -287,16 +287,45 @@
 dbDriver
+%0A%0A  , isArray = Array.isArray
 ;%0A%0Amodul
@@ -406,43 +406,263 @@
 ee()
-;%0A%09dbDriver.getStorage(storageName)
+, storages;%0A%09if (isArray(storageName)) %7B%0A%09%09storages = storageName.map(function (storageName) %7B%0A%09%09%09return dbDriver.getStorage(storageName);%0A%09%09%7D);%0A%09%7D else %7B%0A%09%09storages = %5BdbDriver.getStorage(storageName)%5D;%0A%09%7D%0A%09storages.forEach(function (storage) %7B%0A%09%09storage
 .on(
@@ -710,16 +710,17 @@
 vent) %7B%0A
+%09
 %09%09if (!i
@@ -744,24 +744,25 @@
 erId%5D) %7B%0A%09%09%09
+%09
 itemsMap%5Beve
@@ -825,16 +825,17 @@
 mp %7D;%0A%09%09
+%09
 %7D else %7B
@@ -835,16 +835,17 @@
  else %7B%0A
+%09
 %09%09%09items
@@ -891,18 +891,20 @@
 tamp;%0A%09%09
+%09
 %7D%0A
+%09
 %09%09itemsM
@@ -929,16 +929,22 @@
 event);%0A
+%09%09%7D);%0A
 %09%7D);%0A%09re
@@ -992,28 +992,149 @@
 lvers: %5B
-ensureString
+function (storageName) %7B%0A%09if (isArray(storageName)) return storageName.map(ensureString).sort();%0A%09return ensureString(storageName);%0A%7D
 , functi

Support for multiple storage names