bitovi/canjs — pull request #348 by schovi (2013-04-05 16:42:40+00:00)
Title: Can getobject fix

Summarize of https://github.com/bitovi/canjs/issues/339 issue.

This pull request fixes inconsistent behaviour in can.getObject function mostly when you pass more than one object into functions.

```javascript
// 1) one of objects is not container

// Before
can.getObject('a', [undefined, {a:1}]) // -> undefined

// After
can.getObject('a', [undefined, {a:1}]) // -> 1

// 2) When 'add' is true

// Before
r1 = {a:1};r2 = {b:2}; r = [r1,r2]
can.getObject('b', r, true) // -> {}
r1 // -> {a:1, b:{}}

// After
r1 = {a:1};r2 = {b:2}; r = [r1,r2]
can.getObject('b', r, true) // -> 2
r1 // -> {a:1}
r2 // -> {b:2}

// 3) When 'add' is false (we are removing)

// Before
r1 = {a:1};r2 = {b:2}; r = [r1,r2]
can.getObject('b', r, false) // -> {}
r1 // -> {a:1}
r2 // -> {b:2}

// After
r1 = {a:1};r2 = {b:2}; r = [r1,r2]
can.getObject('b', r, false) // -> 2
r1 // -> {a:1}
r2 // -> {}
```

There are more cases which i cover in tests.