Comparing version 0.2.2 to 0.2.3
@@ -36,2 +36,4 @@ class Masker { | ||
_settleValue(destination, source, prop, Type, layer) { | ||
destination = destination || {}; | ||
source = source || {}; | ||
layer = layer || {}; | ||
@@ -44,5 +46,2 @@ layer = layer.length ? layer[0] : layer; | ||
const settled = {}; | ||
destination = destination || {}; | ||
source = source || {}; | ||
if (!destination[prop] && !source[prop]) { | ||
@@ -49,0 +48,0 @@ return settled; |
{ | ||
"name": "carnaval", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -311,2 +311,27 @@ const test = require('ava'); | ||
class Cart extends Domain { | ||
get props() { | ||
return { | ||
gifts: [Gift] | ||
}; | ||
} | ||
} | ||
test('assign deep array within array, touched (less)', t => { | ||
const mask = Mask.cover(Cart); | ||
const names = ['Shoes', 'Shirt', 'Jeans']; | ||
const cart = new Cart({gifts: [new Gift({names}), new Gift({names})]}); | ||
const touched = mask.settle( | ||
cart, | ||
new Cart({gifts: [new Gift({names: ['Jeans', 'Shirt']})]}) | ||
); | ||
t.deepEqual(cart.gifts[0].names, ['Shoes', 'Shirt', 'Jeans']); | ||
t.deepEqual(cart.gifts[1].names, ['Shoes', 'Shirt', 'Jeans']); | ||
t.deepEqual(touched.gifts[0].names, [true, false, true]); | ||
t.deepEqual(touched.gifts[1].names, [true, true, true]); | ||
}); | ||
class UnreferencedBoxes extends Domain { | ||
@@ -313,0 +338,0 @@ get props() { |
108681
2637