Starcounter-Jack/JSON-Patch — pull request #6 by warpech (2013-05-28 15:10:40+00:00)
Title: Fix problem when observing 2 objects in the same application

There was a collision in `beforeDict` that caused all observed objects to use the same lookup key.

Only browsers without Object.observe support are affected.

This is because only a string can be a object key. If another type is given, implicit conversion takes place - which may lead to unexpected results:

var key = "firstName";
beforeDict[key]; //becomes beforeDict["firstName"]

var key = 2;
beforeDict[key]; //becomes beforeDict["2"]

var key = {firstName: "Marcin"};
beforeDict[key]; //becomes beforeDict["[object Object]"]

I am quite surprised TypeScript does not do anything to help to avoid such pitfalls.

Included in this pull request is a fix and test case.