Sha256: e92012e0b4153c2015a2ec4056a7bd3daec3b12aaea525fedf060c85b933ca5a

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

define([
	"../core"
], function( jQuery ) {

var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;

jQuery.parseJSON = function( data ) {
	// Attempt to parse using the native JSON parser first
	if ( window.JSON && window.JSON.parse ) {
		// Support: Android 2.3
		// Workaround failure to string-cast null input
		return window.JSON.parse( data + "" );
	}

	var requireNonComma,
		depth = null,
		str = jQuery.trim( data + "" );

	// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
	// after removing valid tokens
	return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {

		// Force termination if we see a misplaced comma
		if ( requireNonComma && comma ) {
			depth = 0;
		}

		// Perform no more replacements after returning to outermost depth
		if ( depth === 0 ) {
			return token;
		}

		// Commas must not follow "[", "{", or ","
		requireNonComma = open || comma;

		// Determine new depth
		// array/object open ("[" or "{"): depth += true - false (increment)
		// array/object close ("]" or "}"): depth += false - true (decrement)
		// other cases ("," or primitive): depth += true - true (numeric cast)
		depth += !close - !open;

		// Remove this token
		return "";
	}) ) ?
		( Function( "return " + str ) )() :
		jQuery.error( "Invalid JSON: " + data );
};

return jQuery.parseJSON;

});

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
rails_modular_admin-1.0.0 app/assets/node_modules/jqvmap/node_modules/jquery/src/ajax/parseJSON.js
rails_modular_admin-0.4.0 app/assets/node_modules/jqvmap/node_modules/jquery/src/ajax/parseJSON.js
simpletool-0.0.3 lib/support/phpmyadmin/phpmyadmin/js/jquery/src/jquery/ajax/parseJSON.js
simpletool-0.0.2 lib/support/phpmyadmin/phpmyadmin/js/jquery/src/jquery/ajax/parseJSON.js
kanpachi-0.0.7 lib/kanpachi/doc/template/components/jquery/src/ajax/parseJSON.js
kanpachi-0.0.6 lib/kanpachi/doc/template/components/jquery/src/ajax/parseJSON.js