Fix objects removal.

This commit is contained in:
Julien Fontanet 2015-05-22 15:12:22 +02:00
parent a17f718517
commit d8ca15ceb3

View File

@ -54,17 +54,31 @@ function createAutoLinks (collection, object) {
}
function setMultiple (collection, items) {
const getKey = collection.getKey
forEach(items, function (item) {
const key = getKey(item)
if (!key) {
return
}
createAutoLinks(item)
collection.set(item)
collection.set(key, item)
})
}
function unsetMultiple (collection, items) {
const getKey = collection.getKey
forEach(items, function (item) {
if (collection.has(item)) {
collection.remove(item)
const key = getKey(item)
if (!key) {
return
}
if (collection.has(key)) {
collection.remove(key)
}
})
}