@@ -76,48 +76,6 @@ export default class JSONFormat extends Format {
7676 catch ( e ) {
7777 // Fall through if the regexp test fails.
7878 }
79- } else try {
80- /**
81- * Parsing happens in three stages. In the first stage, we run the
82- * text against a regular expression which looks for non-JSON
83- * characters. We are especially concerned with '()' and 'new'
84- * because they can cause invocation, and '=' because it can
85- * cause mutation. But just to be safe, we will reject all
86- * unexpected characters.
87- */
88- if ( / ^ [ \] , : { } \s ] * $ / . test ( json . replace ( / \\ [ " \\ \/ b f n r t u ] / g, '@' ) . replace ( / " [ ^ " \\ \n \r ] * " | t r u e | f a l s e | n u l l | - ? \d + (?: \. \d * ) ? (?: [ e E ] [ + \- ] ? \d + ) ? / g, ']' ) . replace ( / (?: ^ | : | , ) (?: \s * \[ ) + / g, '' ) ) ) {
89-
90- /**
91- * In the second stage we use the eval function to compile the
92- * text into a JavaScript structure. The '{' operator is
93- * subject to a syntactic ambiguity in JavaScript - it can
94- * begin a block or an object literal. We wrap the text in
95- * parens to eliminate the ambiguity.
96- */
97- object = eval ( '(' + json + ')' ) ;
98-
99- /**
100- * In the optional third stage, we recursively walk the new
101- * structure, passing each name/value pair to a filter
102- * function for possible transformation.
103- */
104- if ( typeof filter === 'function' ) {
105- function walk ( k , v ) {
106- if ( v && typeof v === 'object' ) {
107- for ( var i in v ) {
108- if ( v . hasOwnProperty ( i ) ) {
109- v [ i ] = walk ( i , v [ i ] ) ;
110- }
111- }
112- }
113- return filter ( k , v ) ;
114- }
115-
116- object = walk ( '' , object ) ;
117- }
118- }
119- } catch ( e ) {
120- // Fall through if the regexp test fails.
12179 }
12280
12381 if ( this . keepData ) {
0 commit comments