esprima
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"files": [ | ||
@@ -13,0 +13,0 @@ "bin", |
@@ -74,2 +74,28 @@ /* | ||
function sortedObject(o) { | ||
if (o === null) { | ||
return o; | ||
} | ||
if (o instanceof Array) { | ||
return o.map(sortedObject); | ||
} | ||
if (typeof o !== 'object') { | ||
return o; | ||
} | ||
if (o instanceof RegExp) { | ||
return o; | ||
} | ||
var keys = Object.keys(o); | ||
var result = { | ||
range: undefined, | ||
loc: undefined | ||
}; | ||
keys.forEach(function (key) { | ||
if (o.hasOwnProperty(key)){ | ||
result[key] = sortedObject(o[key]); | ||
} | ||
}); | ||
return result; | ||
} | ||
function hasAttachedComment(syntax) { | ||
@@ -129,2 +155,3 @@ var key; | ||
syntax = sortedObject(syntax); | ||
expected = JSON.stringify(syntax, null, 4); | ||
@@ -145,3 +172,3 @@ try { | ||
} | ||
tree = sortedObject(tree); | ||
actual = JSON.stringify(tree, adjustRegexLiteral, 4); | ||
@@ -174,2 +201,3 @@ | ||
options.loc = false; | ||
syntax = sortedObject(syntax); | ||
expected = JSON.stringify(syntax, filter, 4); | ||
@@ -185,3 +213,3 @@ try { | ||
} | ||
tree = sortedObject(tree); | ||
actual = JSON.stringify(tree, filter, 4); | ||
@@ -188,0 +216,0 @@ } catch (e) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1039192
28958