Permalink
Browse files

Make json.js usable directly in the browser

  • Loading branch information...
1 parent 11d8ffd commit 87f6ba4f5d00be115fcbee8c1ae84763614a4490 @kriszyp committed Oct 14, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 json.js
View
7 json.js
@@ -1,7 +1,8 @@
/**
* This is a port of Dojo's JSON module
*/
-
+(function(define){
+define(function(require, exports){
if(typeof JSON === "undefined"){
exports.parse = function(/*String*/ json){
// summary:
@@ -128,4 +129,6 @@ exports.stringify = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*
else{
exports.parse = JSON.parse;
exports.stringify = JSON.stringify;
-}
+}
+});
+})(typeof define == "undefined" ? function(factory){factory(require, exports);} : define);

0 comments on commit 87f6ba4

Please sign in to comment.