MCPcopy
hub / github.com/jquery/esprima / sortedObject

Function sortedObject

test/utils/evaluate-testcase.js:50–82  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

48 }
49
50 function sortedObject(o) {
51 var keys, result;
52 if (o === null) {
53 return o;
54 }
55 if (Array.isArray(o)) {
56 return o.map(sortedObject);
57 }
58 if (typeof o !== 'object') {
59 return o;
60 }
61 if (o instanceof RegExp) {
62 return o;
63 }
64 keys = Object.keys(o);
65 result = {
66 range: undefined,
67 loc: undefined
68 };
69 keys.forEach(function (key) {
70 if (o.hasOwnProperty(key)) {
71 result[key] = sortedObject(o[key]);
72
73 // Nullify regex value for ES6 regex flags
74 if (key === 'value' && o.hasOwnProperty('regex')) {
75 if (o.regex.flags.match(/[uy]/)) {
76 result[key] = null;
77 }
78 }
79 }
80 });
81 return result;
82 }
83
84 function hasAttachedComment(syntax) {
85 var key;

Callers 1

testParseFunction · 0.70

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…