sdk/src/third-party/easyXDM/easyXDM.js
function(){
    var cached = {};
    var obj = {
        a: [1, 2, 3]
    }, json = "{\"a\":[1,2,3]}";
    
    if (typeof JSON != "undefined" && typeof JSON.stringify === "function" && JSON.stringify(obj).replace((/\s/g), "") === json) {
        // this is a working JSON instance
        return JSON;
    }
    if (Object.toJSON) {
        if (Object.toJSON(obj).replace((/\s/g), "") === json) {
            // this is a working stringify method
            cached.stringify = Object.toJSON;
        }
    }
    
    if (typeof String.prototype.evalJSON === "function") {
        obj = json.evalJSON();
        if (obj.a && obj.a.length === 3 && obj.a[2] === 3) {
            // this is a working parse method           
            cached.parse = function(str){
                return str.evalJSON();
            };
        }
    }
    
    if (cached.stringify && cached.parse) {
        // Only memoize the result if we have valid instance
        getJSON = function(){
            return cached;
        };
        return cached;
    }
    return null;
}
function(){
    var cached = {};
    var obj = {
        a: [1, 2, 3]
    }, json = "{\"a\":[1,2,3]}";
    
    if (typeof JSON != "undefined" && typeof JSON.stringify === "function" && JSON.stringify(obj).replace((/\s/g), "") === json) {
        // this is a working JSON instance
        return JSON;
    }
    if (Object.toJSON) {
        if (Object.toJSON(obj).replace((/\s/g), "") === json) {
            // this is a working stringify method
            cached.stringify = Object.toJSON;
        }
    }
    
    if (typeof String.prototype.evalJSON === "function") {
        obj = json.evalJSON();
        if (obj.a && obj.a.length === 3 && obj.a[2] === 3) {
            // this is a working parse method           
            cached.parse = function(str){
                return str.evalJSON();
            };
        }
    }
    
    if (cached.stringify && cached.parse) {
        // Only memoize the result if we have valid instance
        getJSON = function(){
            return cached;
        };
        return cached;
    }
    return null;
}
function ( ) { var cached = { } ; var obj = { a : [ 1 , 2 , 3 ] } , json = "{\"a\":[1,2,3]}" ; if ( typeof JSON != "undefined" && typeof JSON . stringify === "function" && JSON . stringify ( obj ) . replace ( ( / \s / g ) , "" ) === json ) { // this is a working JSON instance return JSON ; } if ( Object . toJSON ) { if ( Object . toJSON ( obj ) . replace ( ( / \s / g ) , "" ) === json ) { // this is a working stringify method cached . stringify = Object . toJSON ; } } if ( typeof String . prototype . evalJSON === "function" ) { obj = json . evalJSON ( ) ; if ( obj . a && obj . a . length === 3 && obj . a [ 2 ] === 3 ) { // this is a working parse method            cached . parse = function ( str ) { return str . evalJSON ( ) ; } ; } } if ( cached . stringify && cached . parse ) { // Only memoize the result if we have valid instance getJSON = function ( ) { return cached ; } ; return cached ; } return null ; }
A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
@return {JSON} A valid JSON conforming object, or null if not found.
A safe implementation of HTML5 JSON . Feature testing is used to make sure the implementation works .