third_party/subscriptions-project/swg.js
/**
 * Parses the given `json` string without throwing an exception if not valid.
 * Returns `undefined` if parsing fails.
 * Returns the `Object` corresponding to the JSON string when parsing succeeds.
 * @param {*} json JSON string to parse
 * @param {function(!Error)=} onFailed Optional function that will be called
 *     with the error if parsing fails.
 * @return {?JsonObject|undefined} May be extend to parse arrays.
 */
Parses the given `json` string without throwing an exception if not valid.
Returns `undefined` if parsing fails.
Returns the `Object` corresponding to the JSON string when parsing succeeds.
@param {*} json JSON string to parse
@param {function(!Error)=} onFailed Optional function that will be called
with the error if parsing fails.
@return {?JsonObject|undefined} May be extend to parse arrays.
Parses the given ` json ` string without throwing an exception if not valid . Returns ` undefined ` if parsing fails . Returns the ` Object ` corresponding to the JSON string when parsing succeeds . @param { * } json JSON string to parse @param { function ( !Error ) = } onFailed Optional function that will be called with the error if parsing fails . @return { ?JsonObject|undefined } May be extend to parse arrays .
function tryParseJson(json, onFailed) {
  try {
    return parseJson(json);
  } catch (e) {
    if (onFailed) {
      onFailed(e);
    }
    return undefined;
  }
}
function tryParseJson ( json , onFailed ) { try { return parseJson ( json ) ; } catch ( e ) { if ( onFailed ) { onFailed ( e ) ; } return undefined ; } }
Parses the given `json` string without throwing an exception if not valid.
Parses the given ` json ` string without throwing an exception if not valid .