Skip to content

Commit

Permalink
Merge 726415d into e8774e5
Browse files Browse the repository at this point in the history
  • Loading branch information
andykog committed Jan 31, 2016
2 parents e8774e5 + 726415d commit d327864
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ export function makeChildObservable(value, parentMode:ValueMode, context) {
throw "Illegal State";
}

if (Array.isArray(value))
if (Array.isArray(value) && Object.isExtensible(value))
return createObservableArray(<[]> value, childMode, true, context);
if (isPlainObject(value))
if (isPlainObject(value) && Object.isExtensible(value))
return extendObservableHelper(value, value, childMode, context);
return value;
}
Expand Down Expand Up @@ -628,4 +628,4 @@ export function observe(thing, property?, listener?):Lambda {
if (isPlainObject(thing))
return (<any>observable(thing)).$mobservable.observe(listener);
throw new Error("[mobservable.observe] first argument should be an observable array, observable map, observable object or plain object.");
}
}
3 changes: 2 additions & 1 deletion test/makereactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ test('isObservable', function(t) {

t.equal(m.isObservable(m.observable([])), true);
t.equal(m.isObservable(m.observable({})), true);
t.equal(m.isObservable(m.observable(Object.freeze({}))), false);
t.equal(m.isObservable(m.observable(function() {})), true);

t.equal(m.isObservable([]), false);
Expand Down Expand Up @@ -469,4 +470,4 @@ test('exceptions', function(t) {
});

return t.end();
})
})

0 comments on commit d327864

Please sign in to comment.