bestiejs / json3

A JSON polyfill. No longer maintained.
https://bestiejs.github.io/json3
Other
1.02k stars 150 forks source link

Have json3 behave as a shim in browsers even if loaded with require #17

Closed dmp42 closed 12 years ago

dmp42 commented 12 years ago

The problem I'm trying to solve is simple. I want json3 to behave uniformly as a shim in browsers (that is: patch/populate window.JSON if needed), independently of the way it is loaded.

Currently:

But:

Libraries that are willing to provide functionality relying on JSON (without explicitly requiring AMD) would then have to do their own guessing ("if amd then require json else window.JSON"), which is not good IMHO.

This patch tries to fix this shortcoming.

I hope this is cautious enough to not mess-up other (non-browser) environments, but admittedly I'm not familiar with them.

Thanks!

Regards,

ghost commented 12 years ago

Thanks very much for the patch! I've been terribly busy, but I will review it and take action later this weekend.

dmp42 commented 12 years ago

There is no hurry of any sort :) Best.

jeffrose commented 12 years ago

Any progress on this issue?

ghost commented 12 years ago

Merged in f9c5e781d5b5592d04787defcba9e0646a291595. This will go out with the next release. Thanks!