/*
 * Return a globally unique string.
 */
module.exports = function() {
	return module.exports.__namespace + (++module.exports.__id)
}
module.exports.__id = 0
module.exports.__namespace = '__u'
var identity = function(item) { return item }
var itemId = function(item) { return item.id }

/*
 * Filters a list to unique items
 */
module.exports = function(list, getId) {
	if (!list || !list.length) { return [] }
	if (!getId) {
		getId = (list[0].id ? itemId : identity)
	}
	var seen = {}
	var result = []
	for (var i=0; i<list.length; i++) {
		var item = list[i]
		var id = getId(item)
		if (seen[id]) { continue }
		seen[id] = true
		result.push(item)
	}
	return result
}

make unique take a list of items and return a list where each item is represented only once