Test case
3 generated files · +6 −6test/inputs/graphql/github1.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github2.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 131 | 131 | return invalidValue(l(ref || "object"), val, key, parent); |
| 132 | 132 | } |
| 133 | - const result: any = {}; | |
| 133 | + const result: any = Object.create(null); | |
| 134 | 134 | Object.getOwnPropertyNames(props).forEach(key => { |
| 135 | 135 | const prop = props[key]; |
| 136 | 136 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -141,7 +141,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 141 | 141 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 142 | 142 | } |
| 143 | 143 | }); |
| 144 | - return result; | |
| 144 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 131 | 131 | return invalidValue(l(ref || "object"), val, key, parent); |
| 132 | 132 | } |
| 133 | - const result: any = {}; | |
| 133 | + const result: any = Object.create(null); | |
| 134 | 134 | Object.getOwnPropertyNames(props).forEach(key => { |
| 135 | 135 | const prop = props[key]; |
| 136 | 136 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -141,7 +141,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 141 | 141 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 142 | 142 | } |
| 143 | 143 | }); |
| 144 | - return result; | |
| 144 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github3.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github4.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github5.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github6.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github7.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github8.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 131 | 131 | return invalidValue(l(ref || "object"), val, key, parent); |
| 132 | 132 | } |
| 133 | - const result: any = {}; | |
| 133 | + const result: any = Object.create(null); | |
| 134 | 134 | Object.getOwnPropertyNames(props).forEach(key => { |
| 135 | 135 | const prop = props[key]; |
| 136 | 136 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -141,7 +141,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 141 | 141 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 142 | 142 | } |
| 143 | 143 | }); |
| 144 | - return result; | |
| 144 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/graphql/github9.graphql
Mgraphql-flowdefault / TopLevel.js+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Mgraphql-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mgraphql-typescriptdefault / TopLevel.ts+2 −2
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 134 | 134 | return invalidValue(l(ref || "object"), val, key, parent); |
| 135 | 135 | } |
| 136 | - const result: any = {}; | |
| 136 | + const result: any = Object.create(null); | |
| 137 | 137 | Object.getOwnPropertyNames(props).forEach(key => { |
| 138 | 138 | const prop = props[key]; |
| 139 | 139 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 145 | 145 | } |
| 146 | 146 | }); |
| 147 | - return result; | |
| 147 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/00c36.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/00ec5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -174,7 +174,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 174 | 174 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 175 | 175 | return invalidValue(l(ref || "object"), val, key, parent); |
| 176 | 176 | } |
| 177 | - const result: any = {}; | |
| 177 | + const result: any = Object.create(null); | |
| 178 | 178 | Object.getOwnPropertyNames(props).forEach(key => { |
| 179 | 179 | const prop = props[key]; |
| 180 | 180 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -185,7 +185,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 185 | 185 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 186 | 186 | } |
| 187 | 187 | }); |
| 188 | - return result; | |
| 188 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -173,7 +173,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 173 | 173 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 174 | 174 | return invalidValue(l(ref || "object"), val, key, parent); |
| 175 | 175 | } |
| 176 | - const result: any = {}; | |
| 176 | + const result: any = Object.create(null); | |
| 177 | 177 | Object.getOwnPropertyNames(props).forEach(key => { |
| 178 | 178 | const prop = props[key]; |
| 179 | 179 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -184,7 +184,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 184 | 184 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 185 | 185 | } |
| 186 | 186 | }); |
| 187 | - return result; | |
| 187 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/010b1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/016af.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/033b1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/050b0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -163,7 +163,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 163 | 163 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 164 | 164 | return invalidValue(l(ref || "object"), val, key, parent); |
| 165 | 165 | } |
| 166 | - const result: any = {}; | |
| 166 | + const result: any = Object.create(null); | |
| 167 | 167 | Object.getOwnPropertyNames(props).forEach(key => { |
| 168 | 168 | const prop = props[key]; |
| 169 | 169 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -174,7 +174,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 174 | 174 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 175 | 175 | } |
| 176 | 176 | }); |
| 177 | - return result; | |
| 177 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/06bee.json
Mflowdefault / TopLevel.js+2 −2
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 152 | 152 | return invalidValue(l(ref || "object"), val, key, parent); |
| 153 | 153 | } |
| 154 | - const result: any = {}; | |
| 154 | + const result: any = Object.create(null); | |
| 155 | 155 | Object.getOwnPropertyNames(props).forEach(key => { |
| 156 | 156 | const prop = props[key]; |
| 157 | 157 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 163 | 163 | } |
| 164 | 164 | }); |
| 165 | - return result; | |
| 165 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/07540.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0779f.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/07c75.json
Mflowdefault / TopLevel.js+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/09f54.json
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0a358.json
Mflowdefault / TopLevel.js+2 −2
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 126 | 126 | return invalidValue(l(ref || "object"), val, key, parent); |
| 127 | 127 | } |
| 128 | - const result: any = {}; | |
| 128 | + const result: any = Object.create(null); | |
| 129 | 129 | Object.getOwnPropertyNames(props).forEach(key => { |
| 130 | 130 | const prop = props[key]; |
| 131 | 131 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 137 | 137 | } |
| 138 | 138 | }); |
| 139 | - return result; | |
| 139 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 123 | 123 | return invalidValue(l(ref || "object"), val, key, parent); |
| 124 | 124 | } |
| 125 | - const result: any = {}; | |
| 125 | + const result: any = Object.create(null); | |
| 126 | 126 | Object.getOwnPropertyNames(props).forEach(key => { |
| 127 | 127 | const prop = props[key]; |
| 128 | 128 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | - return result; | |
| 136 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0a91a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -327,7 +327,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 327 | 327 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 328 | 328 | return invalidValue(l(ref || "object"), val, key, parent); |
| 329 | 329 | } |
| 330 | - const result: any = {}; | |
| 330 | + const result: any = Object.create(null); | |
| 331 | 331 | Object.getOwnPropertyNames(props).forEach(key => { |
| 332 | 332 | const prop = props[key]; |
| 333 | 333 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -338,7 +338,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 338 | 338 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 339 | 339 | } |
| 340 | 340 | }); |
| 341 | - return result; | |
| 341 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -322,7 +322,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 322 | 322 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 323 | 323 | return invalidValue(l(ref || "object"), val, key, parent); |
| 324 | 324 | } |
| 325 | - const result: any = {}; | |
| 325 | + const result: any = Object.create(null); | |
| 326 | 326 | Object.getOwnPropertyNames(props).forEach(key => { |
| 327 | 327 | const prop = props[key]; |
| 328 | 328 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -333,7 +333,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 333 | 333 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 334 | 334 | } |
| 335 | 335 | }); |
| 336 | - return result; | |
| 336 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0b91a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0cffa.json
Mflowdefault / TopLevel.js+2 −2
| @@ -222,7 +222,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 222 | 222 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 223 | 223 | return invalidValue(l(ref || "object"), val, key, parent); |
| 224 | 224 | } |
| 225 | - const result: any = {}; | |
| 225 | + const result: any = Object.create(null); | |
| 226 | 226 | Object.getOwnPropertyNames(props).forEach(key => { |
| 227 | 227 | const prop = props[key]; |
| 228 | 228 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 234 | 234 | } |
| 235 | 235 | }); |
| 236 | - return result; | |
| 236 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0e0c2.json
Mflowdefault / TopLevel.js+2 −2
| @@ -184,7 +184,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 184 | 184 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 185 | 185 | return invalidValue(l(ref || "object"), val, key, parent); |
| 186 | 186 | } |
| 187 | - const result: any = {}; | |
| 187 | + const result: any = Object.create(null); | |
| 188 | 188 | Object.getOwnPropertyNames(props).forEach(key => { |
| 189 | 189 | const prop = props[key]; |
| 190 | 190 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -195,7 +195,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 195 | 195 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 196 | 196 | } |
| 197 | 197 | }); |
| 198 | - return result; | |
| 198 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -178,7 +178,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 178 | 178 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 179 | 179 | return invalidValue(l(ref || "object"), val, key, parent); |
| 180 | 180 | } |
| 181 | - const result: any = {}; | |
| 181 | + const result: any = Object.create(null); | |
| 182 | 182 | Object.getOwnPropertyNames(props).forEach(key => { |
| 183 | 183 | const prop = props[key]; |
| 184 | 184 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -189,7 +189,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 189 | 189 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 190 | 190 | } |
| 191 | 191 | }); |
| 192 | - return result; | |
| 192 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/0fecf.json
Mflowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/10be4.json
Mflowdefault / TopLevel.js+2 −2
| @@ -174,7 +174,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 174 | 174 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 175 | 175 | return invalidValue(l(ref || "object"), val, key, parent); |
| 176 | 176 | } |
| 177 | - const result: any = {}; | |
| 177 | + const result: any = Object.create(null); | |
| 178 | 178 | Object.getOwnPropertyNames(props).forEach(key => { |
| 179 | 179 | const prop = props[key]; |
| 180 | 180 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -185,7 +185,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 185 | 185 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 186 | 186 | } |
| 187 | 187 | }); |
| 188 | - return result; | |
| 188 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/112b5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/127a1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 222 | 222 | return invalidValue(l(ref || "object"), val, key, parent); |
| 223 | 223 | } |
| 224 | - const result: any = {}; | |
| 224 | + const result: any = Object.create(null); | |
| 225 | 225 | Object.getOwnPropertyNames(props).forEach(key => { |
| 226 | 226 | const prop = props[key]; |
| 227 | 227 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -232,7 +232,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 232 | 232 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 233 | 233 | } |
| 234 | 234 | }); |
| 235 | - return result; | |
| 235 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/13d8d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 134 | 134 | return invalidValue(l(ref || "object"), val, key, parent); |
| 135 | 135 | } |
| 136 | - const result: any = {}; | |
| 136 | + const result: any = Object.create(null); | |
| 137 | 137 | Object.getOwnPropertyNames(props).forEach(key => { |
| 138 | 138 | const prop = props[key]; |
| 139 | 139 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 145 | 145 | } |
| 146 | 146 | }); |
| 147 | - return result; | |
| 147 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 134 | 134 | return invalidValue(l(ref || "object"), val, key, parent); |
| 135 | 135 | } |
| 136 | - const result: any = {}; | |
| 136 | + const result: any = Object.create(null); | |
| 137 | 137 | Object.getOwnPropertyNames(props).forEach(key => { |
| 138 | 138 | const prop = props[key]; |
| 139 | 139 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 145 | 145 | } |
| 146 | 146 | }); |
| 147 | - return result; | |
| 147 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/14d38.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/167d6.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/16bc5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/176f1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/1a7f5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/1b28c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/1b409.json
Mflowdefault / TopLevel.js+2 −2
| @@ -198,7 +198,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 198 | 198 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 199 | 199 | return invalidValue(l(ref || "object"), val, key, parent); |
| 200 | 200 | } |
| 201 | - const result: any = {}; | |
| 201 | + const result: any = Object.create(null); | |
| 202 | 202 | Object.getOwnPropertyNames(props).forEach(key => { |
| 203 | 203 | const prop = props[key]; |
| 204 | 204 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -209,7 +209,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 209 | 209 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 210 | 210 | } |
| 211 | 211 | }); |
| 212 | - return result; | |
| 212 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -181,7 +181,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 181 | 181 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 182 | 182 | return invalidValue(l(ref || "object"), val, key, parent); |
| 183 | 183 | } |
| 184 | - const result: any = {}; | |
| 184 | + const result: any = Object.create(null); | |
| 185 | 185 | Object.getOwnPropertyNames(props).forEach(key => { |
| 186 | 186 | const prop = props[key]; |
| 187 | 187 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -192,7 +192,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 192 | 192 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 193 | 193 | } |
| 194 | 194 | }); |
| 195 | - return result; | |
| 195 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/2465e.json
Mflowdefault / TopLevel.js+2 −2
| @@ -180,7 +180,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 180 | 180 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 181 | 181 | return invalidValue(l(ref || "object"), val, key, parent); |
| 182 | 182 | } |
| 183 | - const result: any = {}; | |
| 183 | + const result: any = Object.create(null); | |
| 184 | 184 | Object.getOwnPropertyNames(props).forEach(key => { |
| 185 | 185 | const prop = props[key]; |
| 186 | 186 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 192 | 192 | } |
| 193 | 193 | }); |
| 194 | - return result; | |
| 194 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -180,7 +180,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 180 | 180 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 181 | 181 | return invalidValue(l(ref || "object"), val, key, parent); |
| 182 | 182 | } |
| 183 | - const result: any = {}; | |
| 183 | + const result: any = Object.create(null); | |
| 184 | 184 | Object.getOwnPropertyNames(props).forEach(key => { |
| 185 | 185 | const prop = props[key]; |
| 186 | 186 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 192 | 192 | } |
| 193 | 193 | }); |
| 194 | - return result; | |
| 194 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/24f52.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/262f0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -210,7 +210,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 210 | 210 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 211 | 211 | return invalidValue(l(ref || "object"), val, key, parent); |
| 212 | 212 | } |
| 213 | - const result: any = {}; | |
| 213 | + const result: any = Object.create(null); | |
| 214 | 214 | Object.getOwnPropertyNames(props).forEach(key => { |
| 215 | 215 | const prop = props[key]; |
| 216 | 216 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 222 | 222 | } |
| 223 | 223 | }); |
| 224 | - return result; | |
| 224 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/26b49.json
Mflowdefault / TopLevel.js+2 −2
| @@ -219,7 +219,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 219 | 219 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 220 | 220 | return invalidValue(l(ref || "object"), val, key, parent); |
| 221 | 221 | } |
| 222 | - const result: any = {}; | |
| 222 | + const result: any = Object.create(null); | |
| 223 | 223 | Object.getOwnPropertyNames(props).forEach(key => { |
| 224 | 224 | const prop = props[key]; |
| 225 | 225 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -230,7 +230,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 230 | 230 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 231 | 231 | } |
| 232 | 232 | }); |
| 233 | - return result; | |
| 233 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -214,7 +214,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 214 | 214 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 215 | 215 | return invalidValue(l(ref || "object"), val, key, parent); |
| 216 | 216 | } |
| 217 | - const result: any = {}; | |
| 217 | + const result: any = Object.create(null); | |
| 218 | 218 | Object.getOwnPropertyNames(props).forEach(key => { |
| 219 | 219 | const prop = props[key]; |
| 220 | 220 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -225,7 +225,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 225 | 225 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 226 | 226 | } |
| 227 | 227 | }); |
| 228 | - return result; | |
| 228 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/26c9c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -294,7 +294,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 294 | 294 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 295 | 295 | return invalidValue(l(ref || "object"), val, key, parent); |
| 296 | 296 | } |
| 297 | - const result: any = {}; | |
| 297 | + const result: any = Object.create(null); | |
| 298 | 298 | Object.getOwnPropertyNames(props).forEach(key => { |
| 299 | 299 | const prop = props[key]; |
| 300 | 300 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -305,7 +305,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 305 | 305 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 306 | 306 | } |
| 307 | 307 | }); |
| 308 | - return result; | |
| 308 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -294,7 +294,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 294 | 294 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 295 | 295 | return invalidValue(l(ref || "object"), val, key, parent); |
| 296 | 296 | } |
| 297 | - const result: any = {}; | |
| 297 | + const result: any = Object.create(null); | |
| 298 | 298 | Object.getOwnPropertyNames(props).forEach(key => { |
| 299 | 299 | const prop = props[key]; |
| 300 | 300 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -305,7 +305,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 305 | 305 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 306 | 306 | } |
| 307 | 307 | }); |
| 308 | - return result; | |
| 308 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/27332.json
Mflowdefault / TopLevel.js+2 −2
| @@ -260,7 +260,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 260 | 260 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 261 | 261 | return invalidValue(l(ref || "object"), val, key, parent); |
| 262 | 262 | } |
| 263 | - const result: any = {}; | |
| 263 | + const result: any = Object.create(null); | |
| 264 | 264 | Object.getOwnPropertyNames(props).forEach(key => { |
| 265 | 265 | const prop = props[key]; |
| 266 | 266 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -271,7 +271,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 271 | 271 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 272 | 272 | } |
| 273 | 273 | }); |
| 274 | - return result; | |
| 274 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -246,7 +246,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 246 | 246 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 247 | 247 | return invalidValue(l(ref || "object"), val, key, parent); |
| 248 | 248 | } |
| 249 | - const result: any = {}; | |
| 249 | + const result: any = Object.create(null); | |
| 250 | 250 | Object.getOwnPropertyNames(props).forEach(key => { |
| 251 | 251 | const prop = props[key]; |
| 252 | 252 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -257,7 +257,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 257 | 257 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 258 | 258 | } |
| 259 | 259 | }); |
| 260 | - return result; | |
| 260 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/29f47.json
Mflowdefault / TopLevel.js+2 −2
| @@ -246,7 +246,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 246 | 246 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 247 | 247 | return invalidValue(l(ref || "object"), val, key, parent); |
| 248 | 248 | } |
| 249 | - const result: any = {}; | |
| 249 | + const result: any = Object.create(null); | |
| 250 | 250 | Object.getOwnPropertyNames(props).forEach(key => { |
| 251 | 251 | const prop = props[key]; |
| 252 | 252 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -257,7 +257,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 257 | 257 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 258 | 258 | } |
| 259 | 259 | }); |
| 260 | - return result; | |
| 260 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 234 | 234 | return invalidValue(l(ref || "object"), val, key, parent); |
| 235 | 235 | } |
| 236 | - const result: any = {}; | |
| 236 | + const result: any = Object.create(null); | |
| 237 | 237 | Object.getOwnPropertyNames(props).forEach(key => { |
| 238 | 238 | const prop = props[key]; |
| 239 | 239 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 245 | 245 | } |
| 246 | 246 | }); |
| 247 | - return result; | |
| 247 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/2d4e2.json
Mflowdefault / TopLevel.js+2 −2
| @@ -214,7 +214,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 214 | 214 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 215 | 215 | return invalidValue(l(ref || "object"), val, key, parent); |
| 216 | 216 | } |
| 217 | - const result: any = {}; | |
| 217 | + const result: any = Object.create(null); | |
| 218 | 218 | Object.getOwnPropertyNames(props).forEach(key => { |
| 219 | 219 | const prop = props[key]; |
| 220 | 220 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -225,7 +225,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 225 | 225 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 226 | 226 | } |
| 227 | 227 | }); |
| 228 | - return result; | |
| 228 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 192 | 192 | return invalidValue(l(ref || "object"), val, key, parent); |
| 193 | 193 | } |
| 194 | - const result: any = {}; | |
| 194 | + const result: any = Object.create(null); | |
| 195 | 195 | Object.getOwnPropertyNames(props).forEach(key => { |
| 196 | 196 | const prop = props[key]; |
| 197 | 197 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -202,7 +202,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 202 | 202 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 203 | 203 | } |
| 204 | 204 | }); |
| 205 | - return result; | |
| 205 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/2df80.json
Mflowdefault / TopLevel.js+2 −2
| @@ -180,7 +180,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 180 | 180 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 181 | 181 | return invalidValue(l(ref || "object"), val, key, parent); |
| 182 | 182 | } |
| 183 | - const result: any = {}; | |
| 183 | + const result: any = Object.create(null); | |
| 184 | 184 | Object.getOwnPropertyNames(props).forEach(key => { |
| 185 | 185 | const prop = props[key]; |
| 186 | 186 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 192 | 192 | } |
| 193 | 193 | }); |
| 194 | - return result; | |
| 194 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/31189.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 135 | 135 | return invalidValue(l(ref || "object"), val, key, parent); |
| 136 | 136 | } |
| 137 | - const result: any = {}; | |
| 137 | + const result: any = Object.create(null); | |
| 138 | 138 | Object.getOwnPropertyNames(props).forEach(key => { |
| 139 | 139 | const prop = props[key]; |
| 140 | 140 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -145,7 +145,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 145 | 145 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 146 | 146 | } |
| 147 | 147 | }); |
| 148 | - return result; | |
| 148 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/32431.json
Mflowdefault / TopLevel.js+2 −2
| @@ -178,7 +178,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 178 | 178 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 179 | 179 | return invalidValue(l(ref || "object"), val, key, parent); |
| 180 | 180 | } |
| 181 | - const result: any = {}; | |
| 181 | + const result: any = Object.create(null); | |
| 182 | 182 | Object.getOwnPropertyNames(props).forEach(key => { |
| 183 | 183 | const prop = props[key]; |
| 184 | 184 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -189,7 +189,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 189 | 189 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 190 | 190 | } |
| 191 | 191 | }); |
| 192 | - return result; | |
| 192 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -170,7 +170,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 170 | 170 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 171 | 171 | return invalidValue(l(ref || "object"), val, key, parent); |
| 172 | 172 | } |
| 173 | - const result: any = {}; | |
| 173 | + const result: any = Object.create(null); | |
| 174 | 174 | Object.getOwnPropertyNames(props).forEach(key => { |
| 175 | 175 | const prop = props[key]; |
| 176 | 176 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -181,7 +181,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 181 | 181 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 182 | 182 | } |
| 183 | 183 | }); |
| 184 | - return result; | |
| 184 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/32d5c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/337ed.json
Mflowdefault / TopLevel.js+2 −2
| @@ -175,7 +175,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 175 | 175 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 176 | 176 | return invalidValue(l(ref || "object"), val, key, parent); |
| 177 | 177 | } |
| 178 | - const result: any = {}; | |
| 178 | + const result: any = Object.create(null); | |
| 179 | 179 | Object.getOwnPropertyNames(props).forEach(key => { |
| 180 | 180 | const prop = props[key]; |
| 181 | 181 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -186,7 +186,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 186 | 186 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 187 | 187 | } |
| 188 | 188 | }); |
| 189 | - return result; | |
| 189 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -165,7 +165,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 165 | 165 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 166 | 166 | return invalidValue(l(ref || "object"), val, key, parent); |
| 167 | 167 | } |
| 168 | - const result: any = {}; | |
| 168 | + const result: any = Object.create(null); | |
| 169 | 169 | Object.getOwnPropertyNames(props).forEach(key => { |
| 170 | 170 | const prop = props[key]; |
| 171 | 171 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -176,7 +176,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 176 | 176 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 177 | 177 | } |
| 178 | 178 | }); |
| 179 | - return result; | |
| 179 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/33d2e.json
Mflowdefault / TopLevel.js+2 −2
| @@ -160,7 +160,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 160 | 160 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 161 | 161 | return invalidValue(l(ref || "object"), val, key, parent); |
| 162 | 162 | } |
| 163 | - const result: any = {}; | |
| 163 | + const result: any = Object.create(null); | |
| 164 | 164 | Object.getOwnPropertyNames(props).forEach(key => { |
| 165 | 165 | const prop = props[key]; |
| 166 | 166 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -171,7 +171,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 171 | 171 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 172 | 172 | } |
| 173 | 173 | }); |
| 174 | - return result; | |
| 174 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -148,7 +148,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 148 | 148 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 149 | 149 | return invalidValue(l(ref || "object"), val, key, parent); |
| 150 | 150 | } |
| 151 | - const result: any = {}; | |
| 151 | + const result: any = Object.create(null); | |
| 152 | 152 | Object.getOwnPropertyNames(props).forEach(key => { |
| 153 | 153 | const prop = props[key]; |
| 154 | 154 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -159,7 +159,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 159 | 159 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 160 | 160 | } |
| 161 | 161 | }); |
| 162 | - return result; | |
| 162 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/34702.json
Mflowdefault / TopLevel.js+2 −2
| @@ -195,7 +195,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 195 | 195 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 196 | 196 | return invalidValue(l(ref || "object"), val, key, parent); |
| 197 | 197 | } |
| 198 | - const result: any = {}; | |
| 198 | + const result: any = Object.create(null); | |
| 199 | 199 | Object.getOwnPropertyNames(props).forEach(key => { |
| 200 | 200 | const prop = props[key]; |
| 201 | 201 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -206,7 +206,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 206 | 206 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 207 | 207 | } |
| 208 | 208 | }); |
| 209 | - return result; | |
| 209 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 163 | 163 | return invalidValue(l(ref || "object"), val, key, parent); |
| 164 | 164 | } |
| 165 | - const result: any = {}; | |
| 165 | + const result: any = Object.create(null); | |
| 166 | 166 | Object.getOwnPropertyNames(props).forEach(key => { |
| 167 | 167 | const prop = props[key]; |
| 168 | 168 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -173,7 +173,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 173 | 173 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 174 | 174 | } |
| 175 | 175 | }); |
| 176 | - return result; | |
| 176 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3536b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3659d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/36d5d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3a6b3.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3e9a3.json
Mflowdefault / TopLevel.js+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 133 | 133 | return invalidValue(l(ref || "object"), val, key, parent); |
| 134 | 134 | } |
| 135 | - const result: any = {}; | |
| 135 | + const result: any = Object.create(null); | |
| 136 | 136 | Object.getOwnPropertyNames(props).forEach(key => { |
| 137 | 137 | const prop = props[key]; |
| 138 | 138 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 144 | 144 | } |
| 145 | 145 | }); |
| 146 | - return result; | |
| 146 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/3f1ce.json
Mflowdefault / TopLevel.js+2 −2
| @@ -208,7 +208,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 208 | 208 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 209 | 209 | return invalidValue(l(ref || "object"), val, key, parent); |
| 210 | 210 | } |
| 211 | - const result: any = {}; | |
| 211 | + const result: any = Object.create(null); | |
| 212 | 212 | Object.getOwnPropertyNames(props).forEach(key => { |
| 213 | 213 | const prop = props[key]; |
| 214 | 214 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -219,7 +219,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 219 | 219 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 220 | 220 | } |
| 221 | 221 | }); |
| 222 | - return result; | |
| 222 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/421d4.json
Mflowdefault / TopLevel.js+2 −2
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 222 | 222 | return invalidValue(l(ref || "object"), val, key, parent); |
| 223 | 223 | } |
| 224 | - const result: any = {}; | |
| 224 | + const result: any = Object.create(null); | |
| 225 | 225 | Object.getOwnPropertyNames(props).forEach(key => { |
| 226 | 226 | const prop = props[key]; |
| 227 | 227 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -232,7 +232,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 232 | 232 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 233 | 233 | } |
| 234 | 234 | }); |
| 235 | - return result; | |
| 235 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 219 | 219 | return invalidValue(l(ref || "object"), val, key, parent); |
| 220 | 220 | } |
| 221 | - const result: any = {}; | |
| 221 | + const result: any = Object.create(null); | |
| 222 | 222 | Object.getOwnPropertyNames(props).forEach(key => { |
| 223 | 223 | const prop = props[key]; |
| 224 | 224 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -229,7 +229,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 229 | 229 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 230 | 230 | } |
| 231 | 231 | }); |
| 232 | - return result; | |
| 232 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/437e7.json
Mflowdefault / TopLevel.js+2 −2
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 217 | 217 | return invalidValue(l(ref || "object"), val, key, parent); |
| 218 | 218 | } |
| 219 | - const result: any = {}; | |
| 219 | + const result: any = Object.create(null); | |
| 220 | 220 | Object.getOwnPropertyNames(props).forEach(key => { |
| 221 | 221 | const prop = props[key]; |
| 222 | 222 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -227,7 +227,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 227 | 227 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 228 | 228 | } |
| 229 | 229 | }); |
| 230 | - return result; | |
| 230 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -211,7 +211,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 211 | 211 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 212 | 212 | return invalidValue(l(ref || "object"), val, key, parent); |
| 213 | 213 | } |
| 214 | - const result: any = {}; | |
| 214 | + const result: any = Object.create(null); | |
| 215 | 215 | Object.getOwnPropertyNames(props).forEach(key => { |
| 216 | 216 | const prop = props[key]; |
| 217 | 217 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -222,7 +222,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 222 | 222 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 223 | 223 | } |
| 224 | 224 | }); |
| 225 | - return result; | |
| 225 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/43970.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/43eaf.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/458db.json
Mflowdefault / TopLevel.js+2 −2
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 150 | 150 | return invalidValue(l(ref || "object"), val, key, parent); |
| 151 | 151 | } |
| 152 | - const result: any = {}; | |
| 152 | + const result: any = Object.create(null); | |
| 153 | 153 | Object.getOwnPropertyNames(props).forEach(key => { |
| 154 | 154 | const prop = props[key]; |
| 155 | 155 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -160,7 +160,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 160 | 160 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 161 | 161 | } |
| 162 | 162 | }); |
| 163 | - return result; | |
| 163 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -148,7 +148,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 148 | 148 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 149 | 149 | return invalidValue(l(ref || "object"), val, key, parent); |
| 150 | 150 | } |
| 151 | - const result: any = {}; | |
| 151 | + const result: any = Object.create(null); | |
| 152 | 152 | Object.getOwnPropertyNames(props).forEach(key => { |
| 153 | 153 | const prop = props[key]; |
| 154 | 154 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -159,7 +159,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 159 | 159 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 160 | 160 | } |
| 161 | 161 | }); |
| 162 | - return result; | |
| 162 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4961a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4a0d7.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4a455.json
Mflowdefault / TopLevel.js+2 −2
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 151 | 151 | return invalidValue(l(ref || "object"), val, key, parent); |
| 152 | 152 | } |
| 153 | - const result: any = {}; | |
| 153 | + const result: any = Object.create(null); | |
| 154 | 154 | Object.getOwnPropertyNames(props).forEach(key => { |
| 155 | 155 | const prop = props[key]; |
| 156 | 156 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -161,7 +161,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 161 | 161 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 162 | 162 | } |
| 163 | 163 | }); |
| 164 | - return result; | |
| 164 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4c547.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4d6fb.json
Mflowdefault / TopLevel.js+2 −2
| @@ -255,7 +255,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 255 | 255 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 256 | 256 | return invalidValue(l(ref || "object"), val, key, parent); |
| 257 | 257 | } |
| 258 | - const result: any = {}; | |
| 258 | + const result: any = Object.create(null); | |
| 259 | 259 | Object.getOwnPropertyNames(props).forEach(key => { |
| 260 | 260 | const prop = props[key]; |
| 261 | 261 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -266,7 +266,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 266 | 266 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 267 | 267 | } |
| 268 | 268 | }); |
| 269 | - return result; | |
| 269 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -245,7 +245,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 245 | 245 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 246 | 246 | return invalidValue(l(ref || "object"), val, key, parent); |
| 247 | 247 | } |
| 248 | - const result: any = {}; | |
| 248 | + const result: any = Object.create(null); | |
| 249 | 249 | Object.getOwnPropertyNames(props).forEach(key => { |
| 250 | 250 | const prop = props[key]; |
| 251 | 251 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -256,7 +256,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 256 | 256 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 257 | 257 | } |
| 258 | 258 | }); |
| 259 | - return result; | |
| 259 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/4e336.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/54147.json
Mflowdefault / TopLevel.js+2 −2
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 124 | 124 | return invalidValue(l(ref || "object"), val, key, parent); |
| 125 | 125 | } |
| 126 | - const result: any = {}; | |
| 126 | + const result: any = Object.create(null); | |
| 127 | 127 | Object.getOwnPropertyNames(props).forEach(key => { |
| 128 | 128 | const prop = props[key]; |
| 129 | 129 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 135 | 135 | } |
| 136 | 136 | }); |
| 137 | - return result; | |
| 137 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/54d32.json
Mflowdefault / TopLevel.js+2 −2
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 130 | 130 | return invalidValue(l(ref || "object"), val, key, parent); |
| 131 | 131 | } |
| 132 | - const result: any = {}; | |
| 132 | + const result: any = Object.create(null); | |
| 133 | 133 | Object.getOwnPropertyNames(props).forEach(key => { |
| 134 | 134 | const prop = props[key]; |
| 135 | 135 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 141 | 141 | } |
| 142 | 142 | }); |
| 143 | - return result; | |
| 143 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 125 | 125 | return invalidValue(l(ref || "object"), val, key, parent); |
| 126 | 126 | } |
| 127 | - const result: any = {}; | |
| 127 | + const result: any = Object.create(null); | |
| 128 | 128 | Object.getOwnPropertyNames(props).forEach(key => { |
| 129 | 129 | const prop = props[key]; |
| 130 | 130 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 136 | 136 | } |
| 137 | 137 | }); |
| 138 | - return result; | |
| 138 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/570ec.json
Mflowdefault / TopLevel.js+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/5dd0d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/5eae5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/5eb20.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/5f3a1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/5f7fe.json
Mflowdefault / TopLevel.js+2 −2
| @@ -295,7 +295,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 295 | 295 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 296 | 296 | return invalidValue(l(ref || "object"), val, key, parent); |
| 297 | 297 | } |
| 298 | - const result: any = {}; | |
| 298 | + const result: any = Object.create(null); | |
| 299 | 299 | Object.getOwnPropertyNames(props).forEach(key => { |
| 300 | 300 | const prop = props[key]; |
| 301 | 301 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -306,7 +306,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 306 | 306 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 307 | 307 | } |
| 308 | 308 | }); |
| 309 | - return result; | |
| 309 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -292,7 +292,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 292 | 292 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 293 | 293 | return invalidValue(l(ref || "object"), val, key, parent); |
| 294 | 294 | } |
| 295 | - const result: any = {}; | |
| 295 | + const result: any = Object.create(null); | |
| 296 | 296 | Object.getOwnPropertyNames(props).forEach(key => { |
| 297 | 297 | const prop = props[key]; |
| 298 | 298 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -303,7 +303,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 303 | 303 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 304 | 304 | } |
| 305 | 305 | }); |
| 306 | - return result; | |
| 306 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/617e8.json
Mflowdefault / TopLevel.js+2 −2
| @@ -294,7 +294,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 294 | 294 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 295 | 295 | return invalidValue(l(ref || "object"), val, key, parent); |
| 296 | 296 | } |
| 297 | - const result: any = {}; | |
| 297 | + const result: any = Object.create(null); | |
| 298 | 298 | Object.getOwnPropertyNames(props).forEach(key => { |
| 299 | 299 | const prop = props[key]; |
| 300 | 300 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -305,7 +305,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 305 | 305 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 306 | 306 | } |
| 307 | 307 | }); |
| 308 | - return result; | |
| 308 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -291,7 +291,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 291 | 291 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 292 | 292 | return invalidValue(l(ref || "object"), val, key, parent); |
| 293 | 293 | } |
| 294 | - const result: any = {}; | |
| 294 | + const result: any = Object.create(null); | |
| 295 | 295 | Object.getOwnPropertyNames(props).forEach(key => { |
| 296 | 296 | const prop = props[key]; |
| 297 | 297 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -302,7 +302,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 302 | 302 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 303 | 303 | } |
| 304 | 304 | }); |
| 305 | - return result; | |
| 305 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/61b66.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6260a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/65dec.json
Mflowdefault / TopLevel.js+2 −2
| @@ -194,7 +194,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 194 | 194 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 195 | 195 | return invalidValue(l(ref || "object"), val, key, parent); |
| 196 | 196 | } |
| 197 | - const result: any = {}; | |
| 197 | + const result: any = Object.create(null); | |
| 198 | 198 | Object.getOwnPropertyNames(props).forEach(key => { |
| 199 | 199 | const prop = props[key]; |
| 200 | 200 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 206 | 206 | } |
| 207 | 207 | }); |
| 208 | - return result; | |
| 208 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -170,7 +170,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 170 | 170 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 171 | 171 | return invalidValue(l(ref || "object"), val, key, parent); |
| 172 | 172 | } |
| 173 | - const result: any = {}; | |
| 173 | + const result: any = Object.create(null); | |
| 174 | 174 | Object.getOwnPropertyNames(props).forEach(key => { |
| 175 | 175 | const prop = props[key]; |
| 176 | 176 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -181,7 +181,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 181 | 181 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 182 | 182 | } |
| 183 | 183 | }); |
| 184 | - return result; | |
| 184 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/66121.json
Mflowdefault / TopLevel.js+2 −2
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 152 | 152 | return invalidValue(l(ref || "object"), val, key, parent); |
| 153 | 153 | } |
| 154 | - const result: any = {}; | |
| 154 | + const result: any = Object.create(null); | |
| 155 | 155 | Object.getOwnPropertyNames(props).forEach(key => { |
| 156 | 156 | const prop = props[key]; |
| 157 | 157 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 163 | 163 | } |
| 164 | 164 | }); |
| 165 | - return result; | |
| 165 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 143 | 143 | return invalidValue(l(ref || "object"), val, key, parent); |
| 144 | 144 | } |
| 145 | - const result: any = {}; | |
| 145 | + const result: any = Object.create(null); | |
| 146 | 146 | Object.getOwnPropertyNames(props).forEach(key => { |
| 147 | 147 | const prop = props[key]; |
| 148 | 148 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | - return result; | |
| 156 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6617c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/67c03.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/68c30.json
Mflowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6c155.json
Mflowdefault / TopLevel.js+2 −2
| @@ -160,7 +160,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 160 | 160 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 161 | 161 | return invalidValue(l(ref || "object"), val, key, parent); |
| 162 | 162 | } |
| 163 | - const result: any = {}; | |
| 163 | + const result: any = Object.create(null); | |
| 164 | 164 | Object.getOwnPropertyNames(props).forEach(key => { |
| 165 | 165 | const prop = props[key]; |
| 166 | 166 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -171,7 +171,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 171 | 171 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 172 | 172 | } |
| 173 | 173 | }); |
| 174 | - return result; | |
| 174 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -160,7 +160,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 160 | 160 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 161 | 161 | return invalidValue(l(ref || "object"), val, key, parent); |
| 162 | 162 | } |
| 163 | - const result: any = {}; | |
| 163 | + const result: any = Object.create(null); | |
| 164 | 164 | Object.getOwnPropertyNames(props).forEach(key => { |
| 165 | 165 | const prop = props[key]; |
| 166 | 166 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -171,7 +171,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 171 | 171 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 172 | 172 | } |
| 173 | 173 | }); |
| 174 | - return result; | |
| 174 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6de06.json
Mflowdefault / TopLevel.js+2 −2
| @@ -255,7 +255,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 255 | 255 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 256 | 256 | return invalidValue(l(ref || "object"), val, key, parent); |
| 257 | 257 | } |
| 258 | - const result: any = {}; | |
| 258 | + const result: any = Object.create(null); | |
| 259 | 259 | Object.getOwnPropertyNames(props).forEach(key => { |
| 260 | 260 | const prop = props[key]; |
| 261 | 261 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -266,7 +266,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 266 | 266 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 267 | 267 | } |
| 268 | 268 | }); |
| 269 | - return result; | |
| 269 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -250,7 +250,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 250 | 250 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 251 | 251 | return invalidValue(l(ref || "object"), val, key, parent); |
| 252 | 252 | } |
| 253 | - const result: any = {}; | |
| 253 | + const result: any = Object.create(null); | |
| 254 | 254 | Object.getOwnPropertyNames(props).forEach(key => { |
| 255 | 255 | const prop = props[key]; |
| 256 | 256 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -261,7 +261,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 261 | 261 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 262 | 262 | } |
| 263 | 263 | }); |
| 264 | - return result; | |
| 264 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6dec6.json
Mflowdefault / TopLevel.js+2 −2
| @@ -210,7 +210,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 210 | 210 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 211 | 211 | return invalidValue(l(ref || "object"), val, key, parent); |
| 212 | 212 | } |
| 213 | - const result: any = {}; | |
| 213 | + const result: any = Object.create(null); | |
| 214 | 214 | Object.getOwnPropertyNames(props).forEach(key => { |
| 215 | 215 | const prop = props[key]; |
| 216 | 216 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 222 | 222 | } |
| 223 | 223 | }); |
| 224 | - return result; | |
| 224 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/6eb00.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/70c77.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/734ad.json
Mflowdefault / TopLevel.js+2 −2
| @@ -181,7 +181,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 181 | 181 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 182 | 182 | return invalidValue(l(ref || "object"), val, key, parent); |
| 183 | 183 | } |
| 184 | - const result: any = {}; | |
| 184 | + const result: any = Object.create(null); | |
| 185 | 185 | Object.getOwnPropertyNames(props).forEach(key => { |
| 186 | 186 | const prop = props[key]; |
| 187 | 187 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -192,7 +192,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 192 | 192 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 193 | 193 | } |
| 194 | 194 | }); |
| 195 | - return result; | |
| 195 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -176,7 +176,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 176 | 176 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 177 | 177 | return invalidValue(l(ref || "object"), val, key, parent); |
| 178 | 178 | } |
| 179 | - const result: any = {}; | |
| 179 | + const result: any = Object.create(null); | |
| 180 | 180 | Object.getOwnPropertyNames(props).forEach(key => { |
| 181 | 181 | const prop = props[key]; |
| 182 | 182 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -187,7 +187,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 187 | 187 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 188 | 188 | } |
| 189 | 189 | }); |
| 190 | - return result; | |
| 190 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/75912.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7681c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -223,7 +223,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 223 | 223 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 224 | 224 | return invalidValue(l(ref || "object"), val, key, parent); |
| 225 | 225 | } |
| 226 | - const result: any = {}; | |
| 226 | + const result: any = Object.create(null); | |
| 227 | 227 | Object.getOwnPropertyNames(props).forEach(key => { |
| 228 | 228 | const prop = props[key]; |
| 229 | 229 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -234,7 +234,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 234 | 234 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 235 | 235 | } |
| 236 | 236 | }); |
| 237 | - return result; | |
| 237 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/76ae1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -291,7 +291,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 291 | 291 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 292 | 292 | return invalidValue(l(ref || "object"), val, key, parent); |
| 293 | 293 | } |
| 294 | - const result: any = {}; | |
| 294 | + const result: any = Object.create(null); | |
| 295 | 295 | Object.getOwnPropertyNames(props).forEach(key => { |
| 296 | 296 | const prop = props[key]; |
| 297 | 297 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -302,7 +302,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 302 | 302 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 303 | 303 | } |
| 304 | 304 | }); |
| 305 | - return result; | |
| 305 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -288,7 +288,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 288 | 288 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 289 | 289 | return invalidValue(l(ref || "object"), val, key, parent); |
| 290 | 290 | } |
| 291 | - const result: any = {}; | |
| 291 | + const result: any = Object.create(null); | |
| 292 | 292 | Object.getOwnPropertyNames(props).forEach(key => { |
| 293 | 293 | const prop = props[key]; |
| 294 | 294 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -299,7 +299,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 299 | 299 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 300 | 300 | } |
| 301 | 301 | }); |
| 302 | - return result; | |
| 302 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/77392.json
Mflowdefault / TopLevel.js+2 −2
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 135 | 135 | return invalidValue(l(ref || "object"), val, key, parent); |
| 136 | 136 | } |
| 137 | - const result: any = {}; | |
| 137 | + const result: any = Object.create(null); | |
| 138 | 138 | Object.getOwnPropertyNames(props).forEach(key => { |
| 139 | 139 | const prop = props[key]; |
| 140 | 140 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -145,7 +145,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 145 | 145 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 146 | 146 | } |
| 147 | 147 | }); |
| 148 | - return result; | |
| 148 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 123 | 123 | return invalidValue(l(ref || "object"), val, key, parent); |
| 124 | 124 | } |
| 125 | - const result: any = {}; | |
| 125 | + const result: any = Object.create(null); | |
| 126 | 126 | Object.getOwnPropertyNames(props).forEach(key => { |
| 127 | 127 | const prop = props[key]; |
| 128 | 128 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | - return result; | |
| 136 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7d397.json
Mflowdefault / TopLevel.js+2 −2
| @@ -182,7 +182,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 182 | 182 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 183 | 183 | return invalidValue(l(ref || "object"), val, key, parent); |
| 184 | 184 | } |
| 185 | - const result: any = {}; | |
| 185 | + const result: any = Object.create(null); | |
| 186 | 186 | Object.getOwnPropertyNames(props).forEach(key => { |
| 187 | 187 | const prop = props[key]; |
| 188 | 188 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -193,7 +193,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 193 | 193 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 194 | 194 | } |
| 195 | 195 | }); |
| 196 | - return result; | |
| 196 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -180,7 +180,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 180 | 180 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 181 | 181 | return invalidValue(l(ref || "object"), val, key, parent); |
| 182 | 182 | } |
| 183 | - const result: any = {}; | |
| 183 | + const result: any = Object.create(null); | |
| 184 | 184 | Object.getOwnPropertyNames(props).forEach(key => { |
| 185 | 185 | const prop = props[key]; |
| 186 | 186 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 192 | 192 | } |
| 193 | 193 | }); |
| 194 | - return result; | |
| 194 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7d722.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7df41.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7dfa6.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7eb30.json
Mflowdefault / TopLevel.js+2 −2
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 152 | 152 | return invalidValue(l(ref || "object"), val, key, parent); |
| 153 | 153 | } |
| 154 | - const result: any = {}; | |
| 154 | + const result: any = Object.create(null); | |
| 155 | 155 | Object.getOwnPropertyNames(props).forEach(key => { |
| 156 | 156 | const prop = props[key]; |
| 157 | 157 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 163 | 163 | } |
| 164 | 164 | }); |
| 165 | - return result; | |
| 165 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 145 | 145 | return invalidValue(l(ref || "object"), val, key, parent); |
| 146 | 146 | } |
| 147 | - const result: any = {}; | |
| 147 | + const result: any = Object.create(null); | |
| 148 | 148 | Object.getOwnPropertyNames(props).forEach(key => { |
| 149 | 149 | const prop = props[key]; |
| 150 | 150 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -155,7 +155,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 155 | 155 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 156 | 156 | } |
| 157 | 157 | }); |
| 158 | - return result; | |
| 158 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7f568.json
Mflowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/7fbfb.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/80aff.json
Mflowdefault / TopLevel.js+2 −2
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 127 | 127 | return invalidValue(l(ref || "object"), val, key, parent); |
| 128 | 128 | } |
| 129 | - const result: any = {}; | |
| 129 | + const result: any = Object.create(null); | |
| 130 | 130 | Object.getOwnPropertyNames(props).forEach(key => { |
| 131 | 131 | const prop = props[key]; |
| 132 | 132 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -137,7 +137,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 137 | 137 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 138 | 138 | } |
| 139 | 139 | }); |
| 140 | - return result; | |
| 140 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 124 | 124 | return invalidValue(l(ref || "object"), val, key, parent); |
| 125 | 125 | } |
| 126 | - const result: any = {}; | |
| 126 | + const result: any = Object.create(null); | |
| 127 | 127 | Object.getOwnPropertyNames(props).forEach(key => { |
| 128 | 128 | const prop = props[key]; |
| 129 | 129 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 135 | 135 | } |
| 136 | 136 | }); |
| 137 | - return result; | |
| 137 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/82509.json
Mflowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/8592b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -230,7 +230,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 230 | 230 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 231 | 231 | return invalidValue(l(ref || "object"), val, key, parent); |
| 232 | 232 | } |
| 233 | - const result: any = {}; | |
| 233 | + const result: any = Object.create(null); | |
| 234 | 234 | Object.getOwnPropertyNames(props).forEach(key => { |
| 235 | 235 | const prop = props[key]; |
| 236 | 236 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -241,7 +241,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 241 | 241 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 242 | 242 | } |
| 243 | 243 | }); |
| 244 | - return result; | |
| 244 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -219,7 +219,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 219 | 219 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 220 | 220 | return invalidValue(l(ref || "object"), val, key, parent); |
| 221 | 221 | } |
| 222 | - const result: any = {}; | |
| 222 | + const result: any = Object.create(null); | |
| 223 | 223 | Object.getOwnPropertyNames(props).forEach(key => { |
| 224 | 224 | const prop = props[key]; |
| 225 | 225 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -230,7 +230,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 230 | 230 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 231 | 231 | } |
| 232 | 232 | }); |
| 233 | - return result; | |
| 233 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/88130.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/8a62c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/908db.json
Mflowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9617f.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/96f7c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9847b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9929c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/996bd.json
Mflowdefault / TopLevel.js+2 −2
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 152 | 152 | return invalidValue(l(ref || "object"), val, key, parent); |
| 153 | 153 | } |
| 154 | - const result: any = {}; | |
| 154 | + const result: any = Object.create(null); | |
| 155 | 155 | Object.getOwnPropertyNames(props).forEach(key => { |
| 156 | 156 | const prop = props[key]; |
| 157 | 157 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -162,7 +162,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 162 | 162 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 163 | 163 | } |
| 164 | 164 | }); |
| 165 | - return result; | |
| 165 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9a503.json
Mflowdefault / TopLevel.js+2 −2
| @@ -137,7 +137,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 137 | 137 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 138 | 138 | return invalidValue(l(ref || "object"), val, key, parent); |
| 139 | 139 | } |
| 140 | - const result: any = {}; | |
| 140 | + const result: any = Object.create(null); | |
| 141 | 141 | Object.getOwnPropertyNames(props).forEach(key => { |
| 142 | 142 | const prop = props[key]; |
| 143 | 143 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -148,7 +148,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 148 | 148 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 149 | 149 | } |
| 150 | 150 | }); |
| 151 | - return result; | |
| 151 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 135 | 135 | return invalidValue(l(ref || "object"), val, key, parent); |
| 136 | 136 | } |
| 137 | - const result: any = {}; | |
| 137 | + const result: any = Object.create(null); | |
| 138 | 138 | Object.getOwnPropertyNames(props).forEach(key => { |
| 139 | 139 | const prop = props[key]; |
| 140 | 140 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -145,7 +145,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 145 | 145 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 146 | 146 | } |
| 147 | 147 | }); |
| 148 | - return result; | |
| 148 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9ac3b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/9eed5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 135 | 135 | return invalidValue(l(ref || "object"), val, key, parent); |
| 136 | 136 | } |
| 137 | - const result: any = {}; | |
| 137 | + const result: any = Object.create(null); | |
| 138 | 138 | Object.getOwnPropertyNames(props).forEach(key => { |
| 139 | 139 | const prop = props[key]; |
| 140 | 140 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -145,7 +145,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 145 | 145 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 146 | 146 | } |
| 147 | 147 | }); |
| 148 | - return result; | |
| 148 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a0496.json
Mflowdefault / TopLevel.js+2 −2
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 129 | 129 | return invalidValue(l(ref || "object"), val, key, parent); |
| 130 | 130 | } |
| 131 | - const result: any = {}; | |
| 131 | + const result: any = Object.create(null); | |
| 132 | 132 | Object.getOwnPropertyNames(props).forEach(key => { |
| 133 | 133 | const prop = props[key]; |
| 134 | 134 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 140 | 140 | } |
| 141 | 141 | }); |
| 142 | - return result; | |
| 142 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 126 | 126 | return invalidValue(l(ref || "object"), val, key, parent); |
| 127 | 127 | } |
| 128 | - const result: any = {}; | |
| 128 | + const result: any = Object.create(null); | |
| 129 | 129 | Object.getOwnPropertyNames(props).forEach(key => { |
| 130 | 130 | const prop = props[key]; |
| 131 | 131 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 137 | 137 | } |
| 138 | 138 | }); |
| 139 | - return result; | |
| 139 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a1eca.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a3d8c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -223,7 +223,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 223 | 223 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 224 | 224 | return invalidValue(l(ref || "object"), val, key, parent); |
| 225 | 225 | } |
| 226 | - const result: any = {}; | |
| 226 | + const result: any = Object.create(null); | |
| 227 | 227 | Object.getOwnPropertyNames(props).forEach(key => { |
| 228 | 228 | const prop = props[key]; |
| 229 | 229 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -234,7 +234,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 234 | 234 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 235 | 235 | } |
| 236 | 236 | }); |
| 237 | - return result; | |
| 237 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -217,7 +217,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 217 | 217 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 218 | 218 | return invalidValue(l(ref || "object"), val, key, parent); |
| 219 | 219 | } |
| 220 | - const result: any = {}; | |
| 220 | + const result: any = Object.create(null); | |
| 221 | 221 | Object.getOwnPropertyNames(props).forEach(key => { |
| 222 | 222 | const prop = props[key]; |
| 223 | 223 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -228,7 +228,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 228 | 228 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 229 | 229 | } |
| 230 | 230 | }); |
| 231 | - return result; | |
| 231 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a45b0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a71df.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/a9691.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ab0d1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/abb4b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ac944.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ad8be.json
Mflowdefault / TopLevel.js+2 −2
| @@ -174,7 +174,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 174 | 174 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 175 | 175 | return invalidValue(l(ref || "object"), val, key, parent); |
| 176 | 176 | } |
| 177 | - const result: any = {}; | |
| 177 | + const result: any = Object.create(null); | |
| 178 | 178 | Object.getOwnPropertyNames(props).forEach(key => { |
| 179 | 179 | const prop = props[key]; |
| 180 | 180 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -185,7 +185,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 185 | 185 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 186 | 186 | } |
| 187 | 187 | }); |
| 188 | - return result; | |
| 188 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ae7f0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -204,7 +204,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 204 | 204 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 205 | 205 | return invalidValue(l(ref || "object"), val, key, parent); |
| 206 | 206 | } |
| 207 | - const result: any = {}; | |
| 207 | + const result: any = Object.create(null); | |
| 208 | 208 | Object.getOwnPropertyNames(props).forEach(key => { |
| 209 | 209 | const prop = props[key]; |
| 210 | 210 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 216 | 216 | } |
| 217 | 217 | }); |
| 218 | - return result; | |
| 218 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -195,7 +195,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 195 | 195 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 196 | 196 | return invalidValue(l(ref || "object"), val, key, parent); |
| 197 | 197 | } |
| 198 | - const result: any = {}; | |
| 198 | + const result: any = Object.create(null); | |
| 199 | 199 | Object.getOwnPropertyNames(props).forEach(key => { |
| 200 | 200 | const prop = props[key]; |
| 201 | 201 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -206,7 +206,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 206 | 206 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 207 | 207 | } |
| 208 | 208 | }); |
| 209 | - return result; | |
| 209 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ae9ca.json
Mflowdefault / TopLevel.js+2 −2
| @@ -153,7 +153,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 153 | 153 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 154 | 154 | return invalidValue(l(ref || "object"), val, key, parent); |
| 155 | 155 | } |
| 156 | - const result: any = {}; | |
| 156 | + const result: any = Object.create(null); | |
| 157 | 157 | Object.getOwnPropertyNames(props).forEach(key => { |
| 158 | 158 | const prop = props[key]; |
| 159 | 159 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -164,7 +164,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 164 | 164 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 165 | 165 | } |
| 166 | 166 | }); |
| 167 | - return result; | |
| 167 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -143,7 +143,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 143 | 143 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 144 | 144 | return invalidValue(l(ref || "object"), val, key, parent); |
| 145 | 145 | } |
| 146 | - const result: any = {}; | |
| 146 | + const result: any = Object.create(null); | |
| 147 | 147 | Object.getOwnPropertyNames(props).forEach(key => { |
| 148 | 148 | const prop = props[key]; |
| 149 | 149 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -154,7 +154,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 154 | 154 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 155 | 155 | } |
| 156 | 156 | }); |
| 157 | - return result; | |
| 157 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/af2d1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -193,7 +193,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 193 | 193 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 194 | 194 | return invalidValue(l(ref || "object"), val, key, parent); |
| 195 | 195 | } |
| 196 | - const result: any = {}; | |
| 196 | + const result: any = Object.create(null); | |
| 197 | 197 | Object.getOwnPropertyNames(props).forEach(key => { |
| 198 | 198 | const prop = props[key]; |
| 199 | 199 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -204,7 +204,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 204 | 204 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 205 | 205 | } |
| 206 | 206 | }); |
| 207 | - return result; | |
| 207 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/b4865.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/b6f2c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/b6fe5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/b9f64.json
Mflowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/bb1ec.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/be234.json
Mflowdefault / TopLevel.js+2 −2
| @@ -269,7 +269,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 269 | 269 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 270 | 270 | return invalidValue(l(ref || "object"), val, key, parent); |
| 271 | 271 | } |
| 272 | - const result: any = {}; | |
| 272 | + const result: any = Object.create(null); | |
| 273 | 273 | Object.getOwnPropertyNames(props).forEach(key => { |
| 274 | 274 | const prop = props[key]; |
| 275 | 275 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -280,7 +280,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 280 | 280 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 281 | 281 | } |
| 282 | 282 | }); |
| 283 | - return result; | |
| 283 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -256,7 +256,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 256 | 256 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 257 | 257 | return invalidValue(l(ref || "object"), val, key, parent); |
| 258 | 258 | } |
| 259 | - const result: any = {}; | |
| 259 | + const result: any = Object.create(null); | |
| 260 | 260 | Object.getOwnPropertyNames(props).forEach(key => { |
| 261 | 261 | const prop = props[key]; |
| 262 | 262 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -267,7 +267,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 267 | 267 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 268 | 268 | } |
| 269 | 269 | }); |
| 270 | - return result; | |
| 270 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/c0356.json
Mflowdefault / TopLevel.js+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/c0a3a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/c3303.json
Mflowdefault / TopLevel.js+2 −2
| @@ -220,7 +220,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 220 | 220 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 221 | 221 | return invalidValue(l(ref || "object"), val, key, parent); |
| 222 | 222 | } |
| 223 | - const result: any = {}; | |
| 223 | + const result: any = Object.create(null); | |
| 224 | 224 | Object.getOwnPropertyNames(props).forEach(key => { |
| 225 | 225 | const prop = props[key]; |
| 226 | 226 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -231,7 +231,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 231 | 231 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 232 | 232 | } |
| 233 | 233 | }); |
| 234 | - return result; | |
| 234 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -214,7 +214,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 214 | 214 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 215 | 215 | return invalidValue(l(ref || "object"), val, key, parent); |
| 216 | 216 | } |
| 217 | - const result: any = {}; | |
| 217 | + const result: any = Object.create(null); | |
| 218 | 218 | Object.getOwnPropertyNames(props).forEach(key => { |
| 219 | 219 | const prop = props[key]; |
| 220 | 220 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -225,7 +225,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 225 | 225 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 226 | 226 | } |
| 227 | 227 | }); |
| 228 | - return result; | |
| 228 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/c6cfd.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/c8c7e.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cb0cc.json
Mflowdefault / TopLevel.js+2 −2
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 131 | 131 | return invalidValue(l(ref || "object"), val, key, parent); |
| 132 | 132 | } |
| 133 | - const result: any = {}; | |
| 133 | + const result: any = Object.create(null); | |
| 134 | 134 | Object.getOwnPropertyNames(props).forEach(key => { |
| 135 | 135 | const prop = props[key]; |
| 136 | 136 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -141,7 +141,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 141 | 141 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 142 | 142 | } |
| 143 | 143 | }); |
| 144 | - return result; | |
| 144 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 125 | 125 | return invalidValue(l(ref || "object"), val, key, parent); |
| 126 | 126 | } |
| 127 | - const result: any = {}; | |
| 127 | + const result: any = Object.create(null); | |
| 128 | 128 | Object.getOwnPropertyNames(props).forEach(key => { |
| 129 | 129 | const prop = props[key]; |
| 130 | 130 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 136 | 136 | } |
| 137 | 137 | }); |
| 138 | - return result; | |
| 138 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cb81e.json
Mflowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ccd18.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cd238.json
Mflowdefault / TopLevel.js+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 141 | 141 | return invalidValue(l(ref || "object"), val, key, parent); |
| 142 | 142 | } |
| 143 | - const result: any = {}; | |
| 143 | + const result: any = Object.create(null); | |
| 144 | 144 | Object.getOwnPropertyNames(props).forEach(key => { |
| 145 | 145 | const prop = props[key]; |
| 146 | 146 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -151,7 +151,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 151 | 151 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 152 | 152 | } |
| 153 | 153 | }); |
| 154 | - return result; | |
| 154 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cd463.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cda6c.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cf0d8.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/cfbce.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/d0908.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/d23d5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 126 | 126 | return invalidValue(l(ref || "object"), val, key, parent); |
| 127 | 127 | } |
| 128 | - const result: any = {}; | |
| 128 | + const result: any = Object.create(null); | |
| 129 | 129 | Object.getOwnPropertyNames(props).forEach(key => { |
| 130 | 130 | const prop = props[key]; |
| 131 | 131 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 137 | 137 | } |
| 138 | 138 | }); |
| 139 | - return result; | |
| 139 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 123 | 123 | return invalidValue(l(ref || "object"), val, key, parent); |
| 124 | 124 | } |
| 125 | - const result: any = {}; | |
| 125 | + const result: any = Object.create(null); | |
| 126 | 126 | Object.getOwnPropertyNames(props).forEach(key => { |
| 127 | 127 | const prop = props[key]; |
| 128 | 128 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | - return result; | |
| 136 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/dbfb3.json
Mflowdefault / TopLevel.js+2 −2
| @@ -209,7 +209,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 209 | 209 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 210 | 210 | return invalidValue(l(ref || "object"), val, key, parent); |
| 211 | 211 | } |
| 212 | - const result: any = {}; | |
| 212 | + const result: any = Object.create(null); | |
| 213 | 213 | Object.getOwnPropertyNames(props).forEach(key => { |
| 214 | 214 | const prop = props[key]; |
| 215 | 215 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -220,7 +220,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 220 | 220 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 221 | 221 | } |
| 222 | 222 | }); |
| 223 | - return result; | |
| 223 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/dc44f.json
Mflowdefault / TopLevel.js+2 −2
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 234 | 234 | return invalidValue(l(ref || "object"), val, key, parent); |
| 235 | 235 | } |
| 236 | - const result: any = {}; | |
| 236 | + const result: any = Object.create(null); | |
| 237 | 237 | Object.getOwnPropertyNames(props).forEach(key => { |
| 238 | 238 | const prop = props[key]; |
| 239 | 239 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 245 | 245 | } |
| 246 | 246 | }); |
| 247 | - return result; | |
| 247 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -175,7 +175,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 175 | 175 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 176 | 176 | return invalidValue(l(ref || "object"), val, key, parent); |
| 177 | 177 | } |
| 178 | - const result: any = {}; | |
| 178 | + const result: any = Object.create(null); | |
| 179 | 179 | Object.getOwnPropertyNames(props).forEach(key => { |
| 180 | 180 | const prop = props[key]; |
| 181 | 181 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -186,7 +186,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 186 | 186 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 187 | 187 | } |
| 188 | 188 | }); |
| 189 | - return result; | |
| 189 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/dd1ce.json
Mflowdefault / TopLevel.js+2 −2
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 234 | 234 | return invalidValue(l(ref || "object"), val, key, parent); |
| 235 | 235 | } |
| 236 | - const result: any = {}; | |
| 236 | + const result: any = Object.create(null); | |
| 237 | 237 | Object.getOwnPropertyNames(props).forEach(key => { |
| 238 | 238 | const prop = props[key]; |
| 239 | 239 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 245 | 245 | } |
| 246 | 246 | }); |
| 247 | - return result; | |
| 247 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -175,7 +175,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 175 | 175 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 176 | 176 | return invalidValue(l(ref || "object"), val, key, parent); |
| 177 | 177 | } |
| 178 | - const result: any = {}; | |
| 178 | + const result: any = Object.create(null); | |
| 179 | 179 | Object.getOwnPropertyNames(props).forEach(key => { |
| 180 | 180 | const prop = props[key]; |
| 181 | 181 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -186,7 +186,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 186 | 186 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 187 | 187 | } |
| 188 | 188 | }); |
| 189 | - return result; | |
| 189 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/dec3a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -168,7 +168,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 168 | 168 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 169 | 169 | return invalidValue(l(ref || "object"), val, key, parent); |
| 170 | 170 | } |
| 171 | - const result: any = {}; | |
| 171 | + const result: any = Object.create(null); | |
| 172 | 172 | Object.getOwnPropertyNames(props).forEach(key => { |
| 173 | 173 | const prop = props[key]; |
| 174 | 174 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -179,7 +179,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 179 | 179 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 180 | 180 | } |
| 181 | 181 | }); |
| 182 | - return result; | |
| 182 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -168,7 +168,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 168 | 168 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 169 | 169 | return invalidValue(l(ref || "object"), val, key, parent); |
| 170 | 170 | } |
| 171 | - const result: any = {}; | |
| 171 | + const result: any = Object.create(null); | |
| 172 | 172 | Object.getOwnPropertyNames(props).forEach(key => { |
| 173 | 173 | const prop = props[key]; |
| 174 | 174 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -179,7 +179,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 179 | 179 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 180 | 180 | } |
| 181 | 181 | }); |
| 182 | - return result; | |
| 182 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/df957.json
Mflowdefault / TopLevel.js+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -205,7 +205,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 205 | 205 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 206 | 206 | return invalidValue(l(ref || "object"), val, key, parent); |
| 207 | 207 | } |
| 208 | - const result: any = {}; | |
| 208 | + const result: any = Object.create(null); | |
| 209 | 209 | Object.getOwnPropertyNames(props).forEach(key => { |
| 210 | 210 | const prop = props[key]; |
| 211 | 211 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -216,7 +216,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 216 | 216 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | - return result; | |
| 219 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e0ac7.json
Mflowdefault / TopLevel.js+2 −2
| @@ -217,7 +217,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 217 | 217 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 218 | 218 | return invalidValue(l(ref || "object"), val, key, parent); |
| 219 | 219 | } |
| 220 | - const result: any = {}; | |
| 220 | + const result: any = Object.create(null); | |
| 221 | 221 | Object.getOwnPropertyNames(props).forEach(key => { |
| 222 | 222 | const prop = props[key]; |
| 223 | 223 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -228,7 +228,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 228 | 228 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 229 | 229 | } |
| 230 | 230 | }); |
| 231 | - return result; | |
| 231 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -213,7 +213,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 213 | 213 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 214 | 214 | return invalidValue(l(ref || "object"), val, key, parent); |
| 215 | 215 | } |
| 216 | - const result: any = {}; | |
| 216 | + const result: any = Object.create(null); | |
| 217 | 217 | Object.getOwnPropertyNames(props).forEach(key => { |
| 218 | 218 | const prop = props[key]; |
| 219 | 219 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -224,7 +224,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 224 | 224 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 225 | 225 | } |
| 226 | 226 | }); |
| 227 | - return result; | |
| 227 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e2915.json
Mflowdefault / TopLevel.js+2 −2
| @@ -208,7 +208,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 208 | 208 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 209 | 209 | return invalidValue(l(ref || "object"), val, key, parent); |
| 210 | 210 | } |
| 211 | - const result: any = {}; | |
| 211 | + const result: any = Object.create(null); | |
| 212 | 212 | Object.getOwnPropertyNames(props).forEach(key => { |
| 213 | 213 | const prop = props[key]; |
| 214 | 214 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -219,7 +219,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 219 | 219 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 220 | 220 | } |
| 221 | 221 | }); |
| 222 | - return result; | |
| 222 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -207,7 +207,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 207 | 207 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 208 | 208 | return invalidValue(l(ref || "object"), val, key, parent); |
| 209 | 209 | } |
| 210 | - const result: any = {}; | |
| 210 | + const result: any = Object.create(null); | |
| 211 | 211 | Object.getOwnPropertyNames(props).forEach(key => { |
| 212 | 212 | const prop = props[key]; |
| 213 | 213 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -218,7 +218,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 218 | 218 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 219 | 219 | } |
| 220 | 220 | }); |
| 221 | - return result; | |
| 221 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e2a58.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e324e.json
Mflowdefault / TopLevel.js+2 −2
| @@ -179,7 +179,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 179 | 179 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 180 | 180 | return invalidValue(l(ref || "object"), val, key, parent); |
| 181 | 181 | } |
| 182 | - const result: any = {}; | |
| 182 | + const result: any = Object.create(null); | |
| 183 | 183 | Object.getOwnPropertyNames(props).forEach(key => { |
| 184 | 184 | const prop = props[key]; |
| 185 | 185 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -190,7 +190,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 190 | 190 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 191 | 191 | } |
| 192 | 192 | }); |
| 193 | - return result; | |
| 193 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -178,7 +178,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 178 | 178 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 179 | 179 | return invalidValue(l(ref || "object"), val, key, parent); |
| 180 | 180 | } |
| 181 | - const result: any = {}; | |
| 181 | + const result: any = Object.create(null); | |
| 182 | 182 | Object.getOwnPropertyNames(props).forEach(key => { |
| 183 | 183 | const prop = props[key]; |
| 184 | 184 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -189,7 +189,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 189 | 189 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 190 | 190 | } |
| 191 | 191 | }); |
| 192 | - return result; | |
| 192 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e53b5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 132 | 132 | return invalidValue(l(ref || "object"), val, key, parent); |
| 133 | 133 | } |
| 134 | - const result: any = {}; | |
| 134 | + const result: any = Object.create(null); | |
| 135 | 135 | Object.getOwnPropertyNames(props).forEach(key => { |
| 136 | 136 | const prop = props[key]; |
| 137 | 137 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -142,7 +142,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 142 | 142 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | - return result; | |
| 145 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e64a0.json
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e8a0b.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/e8b04.json
Mflowdefault / TopLevel.js+2 −2
| @@ -377,7 +377,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 377 | 377 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 378 | 378 | return invalidValue(l(ref || "object"), val, key, parent); |
| 379 | 379 | } |
| 380 | - const result: any = {}; | |
| 380 | + const result: any = Object.create(null); | |
| 381 | 381 | Object.getOwnPropertyNames(props).forEach(key => { |
| 382 | 382 | const prop = props[key]; |
| 383 | 383 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -388,7 +388,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 388 | 388 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 389 | 389 | } |
| 390 | 390 | }); |
| 391 | - return result; | |
| 391 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -338,7 +338,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 338 | 338 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 339 | 339 | return invalidValue(l(ref || "object"), val, key, parent); |
| 340 | 340 | } |
| 341 | - const result: any = {}; | |
| 341 | + const result: any = Object.create(null); | |
| 342 | 342 | Object.getOwnPropertyNames(props).forEach(key => { |
| 343 | 343 | const prop = props[key]; |
| 344 | 344 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -349,7 +349,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 349 | 349 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 350 | 350 | } |
| 351 | 351 | }); |
| 352 | - return result; | |
| 352 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/ed095.json
Mflowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f22f5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -201,7 +201,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 201 | 201 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 202 | 202 | return invalidValue(l(ref || "object"), val, key, parent); |
| 203 | 203 | } |
| 204 | - const result: any = {}; | |
| 204 | + const result: any = Object.create(null); | |
| 205 | 205 | Object.getOwnPropertyNames(props).forEach(key => { |
| 206 | 206 | const prop = props[key]; |
| 207 | 207 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -212,7 +212,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 212 | 212 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 213 | 213 | } |
| 214 | 214 | }); |
| 215 | - return result; | |
| 215 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -193,7 +193,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 193 | 193 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 194 | 194 | return invalidValue(l(ref || "object"), val, key, parent); |
| 195 | 195 | } |
| 196 | - const result: any = {}; | |
| 196 | + const result: any = Object.create(null); | |
| 197 | 197 | Object.getOwnPropertyNames(props).forEach(key => { |
| 198 | 198 | const prop = props[key]; |
| 199 | 199 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -204,7 +204,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 204 | 204 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 205 | 205 | } |
| 206 | 206 | }); |
| 207 | - return result; | |
| 207 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f3139.json
Mflowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f3edf.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f466a.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f6a65.json
Mflowdefault / TopLevel.js+2 −2
| @@ -224,7 +224,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 224 | 224 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 225 | 225 | return invalidValue(l(ref || "object"), val, key, parent); |
| 226 | 226 | } |
| 227 | - const result: any = {}; | |
| 227 | + const result: any = Object.create(null); | |
| 228 | 228 | Object.getOwnPropertyNames(props).forEach(key => { |
| 229 | 229 | const prop = props[key]; |
| 230 | 230 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -235,7 +235,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 235 | 235 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 236 | 236 | } |
| 237 | 237 | }); |
| 238 | - return result; | |
| 238 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -215,7 +215,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 215 | 215 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 216 | 216 | return invalidValue(l(ref || "object"), val, key, parent); |
| 217 | 217 | } |
| 218 | - const result: any = {}; | |
| 218 | + const result: any = Object.create(null); | |
| 219 | 219 | Object.getOwnPropertyNames(props).forEach(key => { |
| 220 | 220 | const prop = props[key]; |
| 221 | 221 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 227 | 227 | } |
| 228 | 228 | }); |
| 229 | - return result; | |
| 229 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f74d5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -223,7 +223,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 223 | 223 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 224 | 224 | return invalidValue(l(ref || "object"), val, key, parent); |
| 225 | 225 | } |
| 226 | - const result: any = {}; | |
| 226 | + const result: any = Object.create(null); | |
| 227 | 227 | Object.getOwnPropertyNames(props).forEach(key => { |
| 228 | 228 | const prop = props[key]; |
| 229 | 229 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -234,7 +234,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 234 | 234 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 235 | 235 | } |
| 236 | 236 | }); |
| 237 | - return result; | |
| 237 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -217,7 +217,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 217 | 217 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 218 | 218 | return invalidValue(l(ref || "object"), val, key, parent); |
| 219 | 219 | } |
| 220 | - const result: any = {}; | |
| 220 | + const result: any = Object.create(null); | |
| 221 | 221 | Object.getOwnPropertyNames(props).forEach(key => { |
| 222 | 222 | const prop = props[key]; |
| 223 | 223 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -228,7 +228,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 228 | 228 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 229 | 229 | } |
| 230 | 230 | }); |
| 231 | - return result; | |
| 231 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f82d9.json
Mflowdefault / TopLevel.js+2 −2
| @@ -192,7 +192,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 192 | 192 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 193 | 193 | return invalidValue(l(ref || "object"), val, key, parent); |
| 194 | 194 | } |
| 195 | - const result: any = {}; | |
| 195 | + const result: any = Object.create(null); | |
| 196 | 196 | Object.getOwnPropertyNames(props).forEach(key => { |
| 197 | 197 | const prop = props[key]; |
| 198 | 198 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -203,7 +203,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 203 | 203 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 204 | 204 | } |
| 205 | 205 | }); |
| 206 | - return result; | |
| 206 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -191,7 +191,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 191 | 191 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 192 | 192 | return invalidValue(l(ref || "object"), val, key, parent); |
| 193 | 193 | } |
| 194 | - const result: any = {}; | |
| 194 | + const result: any = Object.create(null); | |
| 195 | 195 | Object.getOwnPropertyNames(props).forEach(key => { |
| 196 | 196 | const prop = props[key]; |
| 197 | 197 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -202,7 +202,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 202 | 202 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 203 | 203 | } |
| 204 | 204 | }); |
| 205 | - return result; | |
| 205 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/f974d.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/faff5.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/fcca3.json
Mflowdefault / TopLevel.js+2 −2
| @@ -320,7 +320,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 320 | 320 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 321 | 321 | return invalidValue(l(ref || "object"), val, key, parent); |
| 322 | 322 | } |
| 323 | - const result: any = {}; | |
| 323 | + const result: any = Object.create(null); | |
| 324 | 324 | Object.getOwnPropertyNames(props).forEach(key => { |
| 325 | 325 | const prop = props[key]; |
| 326 | 326 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -331,7 +331,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 331 | 331 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 332 | 332 | } |
| 333 | 333 | }); |
| 334 | - return result; | |
| 334 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -317,7 +317,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 317 | 317 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 318 | 318 | return invalidValue(l(ref || "object"), val, key, parent); |
| 319 | 319 | } |
| 320 | - const result: any = {}; | |
| 320 | + const result: any = Object.create(null); | |
| 321 | 321 | Object.getOwnPropertyNames(props).forEach(key => { |
| 322 | 322 | const prop = props[key]; |
| 323 | 323 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -328,7 +328,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 328 | 328 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 329 | 329 | } |
| 330 | 330 | }); |
| 331 | - return result; | |
| 331 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/misc/fd329.json
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/blns-object.json
Mflowdefault / TopLevel.js+2 −2
| @@ -702,7 +702,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 702 | 702 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 703 | 703 | return invalidValue(l(ref || "object"), val, key, parent); |
| 704 | 704 | } |
| 705 | - const result: any = {}; | |
| 705 | + const result: any = Object.create(null); | |
| 706 | 706 | Object.getOwnPropertyNames(props).forEach(key => { |
| 707 | 707 | const prop = props[key]; |
| 708 | 708 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -713,7 +713,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 713 | 713 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 714 | 714 | } |
| 715 | 715 | }); |
| 716 | - return result; | |
| 716 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -702,7 +702,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 702 | 702 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 703 | 703 | return invalidValue(l(ref || "object"), val, key, parent); |
| 704 | 704 | } |
| 705 | - const result: any = {}; | |
| 705 | + const result: any = Object.create(null); | |
| 706 | 706 | Object.getOwnPropertyNames(props).forEach(key => { |
| 707 | 707 | const prop = props[key]; |
| 708 | 708 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -713,7 +713,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 713 | 713 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 714 | 714 | } |
| 715 | 715 | }); |
| 716 | - return result; | |
| 716 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug2037.json
Mflowdefault / TopLevel.js+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug2521.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug2590.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug2663.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug2793.json
Mflowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug427.json
Mflowdefault / TopLevel.js+2 −2
| @@ -718,7 +718,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 718 | 718 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 719 | 719 | return invalidValue(l(ref || "object"), val, key, parent); |
| 720 | 720 | } |
| 721 | - const result: any = {}; | |
| 721 | + const result: any = Object.create(null); | |
| 722 | 722 | Object.getOwnPropertyNames(props).forEach(key => { |
| 723 | 723 | const prop = props[key]; |
| 724 | 724 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -729,7 +729,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 729 | 729 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 730 | 730 | } |
| 731 | 731 | }); |
| 732 | - return result; | |
| 732 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -664,7 +664,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 664 | 664 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 665 | 665 | return invalidValue(l(ref || "object"), val, key, parent); |
| 666 | 666 | } |
| 667 | - const result: any = {}; | |
| 667 | + const result: any = Object.create(null); | |
| 668 | 668 | Object.getOwnPropertyNames(props).forEach(key => { |
| 669 | 669 | const prop = props[key]; |
| 670 | 670 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -675,7 +675,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 675 | 675 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 676 | 676 | } |
| 677 | 677 | }); |
| 678 | - return result; | |
| 678 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug790.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug855-short.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/bug863.json
Mflowdefault / TopLevel.js+2 −2
| @@ -193,7 +193,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 193 | 193 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 194 | 194 | return invalidValue(l(ref || "object"), val, key, parent); |
| 195 | 195 | } |
| 196 | - const result: any = {}; | |
| 196 | + const result: any = Object.create(null); | |
| 197 | 197 | Object.getOwnPropertyNames(props).forEach(key => { |
| 198 | 198 | const prop = props[key]; |
| 199 | 199 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -204,7 +204,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 204 | 204 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 205 | 205 | } |
| 206 | 206 | }); |
| 207 | - return result; | |
| 207 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -177,7 +177,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 177 | 177 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 178 | 178 | return invalidValue(l(ref || "object"), val, key, parent); |
| 179 | 179 | } |
| 180 | - const result: any = {}; | |
| 180 | + const result: any = Object.create(null); | |
| 181 | 181 | Object.getOwnPropertyNames(props).forEach(key => { |
| 182 | 182 | const prop = props[key]; |
| 183 | 183 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -188,7 +188,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 188 | 188 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 189 | 189 | } |
| 190 | 190 | }); |
| 191 | - return result; | |
| 191 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/coin-pairs.json
Mflowdefault / TopLevel.js+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Test case
20 generated files · +40 −40test/inputs/json/priority/combinations1.json
Mflowdefault / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mflownice-property-names-true--f4d7920ee2ce / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mflowprefer-unions-false--a5053c0a486d / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mflowprefer-unknown-false--f1ab9e45d823 / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mflowruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = val[key]; |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mjavascriptconverters-top-level--67aa452ed509 / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptraw-type-any--474b307c39db / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = val[key]; |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptacronym-style-pascal--d9e0c1bd777a / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptconverters-all-objects--3a443babd1cb / TopLevel.ts+2 −2
| @@ -603,7 +603,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 603 | 603 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 604 | 604 | return invalidValue(l(ref || "object"), val, key, parent); |
| 605 | 605 | } |
| 606 | - const result: any = {}; | |
| 606 | + const result: any = Object.create(null); | |
| 607 | 607 | Object.getOwnPropertyNames(props).forEach(key => { |
| 608 | 608 | const prop = props[key]; |
| 609 | 609 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -614,7 +614,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 614 | 614 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 615 | 615 | } |
| 616 | 616 | }); |
| 617 | - return result; | |
| 617 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptnice-property-names-true--f4d7920ee2ce / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptprefer-const-values-true--6b26e4d1265c / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptprefer-unions-false--a5053c0a486d / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptprefer-unknown-false--f1ab9e45d823 / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptraw-type-any--474b307c39db / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Mtypescriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.ts+2 −2
| @@ -499,7 +499,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 499 | 499 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 500 | 500 | return invalidValue(l(ref || "object"), val, key, parent); |
| 501 | 501 | } |
| 502 | - const result: any = {}; | |
| 502 | + const result: any = Object.create(null); | |
| 503 | 503 | Object.getOwnPropertyNames(props).forEach(key => { |
| 504 | 504 | const prop = props[key]; |
| 505 | 505 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -510,7 +510,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 510 | 510 | result[key] = val[key]; |
| 511 | 511 | } |
| 512 | 512 | }); |
| 513 | - return result; | |
| 513 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (typ === "any") return val; |
Test case
20 generated files · +40 −40test/inputs/json/priority/combinations2.json
Mflowdefault / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mflownice-property-names-true--f4d7920ee2ce / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mflowprefer-unions-false--a5053c0a486d / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mflowprefer-unknown-false--f1ab9e45d823 / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mflowruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = val[key]; |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mjavascriptconverters-top-level--67aa452ed509 / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptraw-type-any--474b307c39db / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = val[key]; |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptacronym-style-pascal--d9e0c1bd777a / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptconverters-all-objects--3a443babd1cb / TopLevel.ts+2 −2
| @@ -531,7 +531,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 531 | 531 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 532 | 532 | return invalidValue(l(ref || "object"), val, key, parent); |
| 533 | 533 | } |
| 534 | - const result: any = {}; | |
| 534 | + const result: any = Object.create(null); | |
| 535 | 535 | Object.getOwnPropertyNames(props).forEach(key => { |
| 536 | 536 | const prop = props[key]; |
| 537 | 537 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -542,7 +542,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 542 | 542 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 543 | 543 | } |
| 544 | 544 | }); |
| 545 | - return result; | |
| 545 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptnice-property-names-true--f4d7920ee2ce / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptprefer-const-values-true--6b26e4d1265c / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptprefer-unions-false--a5053c0a486d / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptprefer-unknown-false--f1ab9e45d823 / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptraw-type-any--474b307c39db / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Mtypescriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.ts+2 −2
| @@ -451,7 +451,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 451 | 451 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 452 | 452 | return invalidValue(l(ref || "object"), val, key, parent); |
| 453 | 453 | } |
| 454 | - const result: any = {}; | |
| 454 | + const result: any = Object.create(null); | |
| 455 | 455 | Object.getOwnPropertyNames(props).forEach(key => { |
| 456 | 456 | const prop = props[key]; |
| 457 | 457 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -462,7 +462,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 462 | 462 | result[key] = val[key]; |
| 463 | 463 | } |
| 464 | 464 | }); |
| 465 | - return result; | |
| 465 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if (typ === "any") return val; |
Test case
20 generated files · +40 −40test/inputs/json/priority/combinations3.json
Mflowdefault / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mflownice-property-names-true--f4d7920ee2ce / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mflowprefer-unions-false--a5053c0a486d / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mflowprefer-unknown-false--f1ab9e45d823 / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mflowruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = val[key]; |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mjavascriptconverters-top-level--67aa452ed509 / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptraw-type-any--474b307c39db / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = val[key]; |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptacronym-style-pascal--d9e0c1bd777a / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptconverters-all-objects--3a443babd1cb / TopLevel.ts+2 −2
| @@ -667,7 +667,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 667 | 667 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 668 | 668 | return invalidValue(l(ref || "object"), val, key, parent); |
| 669 | 669 | } |
| 670 | - const result: any = {}; | |
| 670 | + const result: any = Object.create(null); | |
| 671 | 671 | Object.getOwnPropertyNames(props).forEach(key => { |
| 672 | 672 | const prop = props[key]; |
| 673 | 673 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -678,7 +678,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 678 | 678 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 679 | 679 | } |
| 680 | 680 | }); |
| 681 | - return result; | |
| 681 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptnice-property-names-true--f4d7920ee2ce / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptprefer-const-values-true--6b26e4d1265c / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptprefer-unions-false--a5053c0a486d / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptprefer-unknown-false--f1ab9e45d823 / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptraw-type-any--474b307c39db / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Mtypescriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.ts+2 −2
| @@ -555,7 +555,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 555 | 555 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 556 | 556 | return invalidValue(l(ref || "object"), val, key, parent); |
| 557 | 557 | } |
| 558 | - const result: any = {}; | |
| 558 | + const result: any = Object.create(null); | |
| 559 | 559 | Object.getOwnPropertyNames(props).forEach(key => { |
| 560 | 560 | const prop = props[key]; |
| 561 | 561 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -566,7 +566,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 566 | 566 | result[key] = val[key]; |
| 567 | 567 | } |
| 568 | 568 | }); |
| 569 | - return result; | |
| 569 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (typ === "any") return val; |
Test case
20 generated files · +40 −40test/inputs/json/priority/combinations4.json
Mflowdefault / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mflownice-property-names-true--f4d7920ee2ce / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mflowprefer-unions-false--a5053c0a486d / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mflowprefer-unknown-false--f1ab9e45d823 / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mflowruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = val[key]; |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mjavascriptconverters-top-level--67aa452ed509 / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptraw-type-any--474b307c39db / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = val[key]; |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptacronym-style-pascal--d9e0c1bd777a / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptconverters-all-objects--3a443babd1cb / TopLevel.ts+2 −2
| @@ -753,7 +753,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 753 | 753 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 754 | 754 | return invalidValue(l(ref || "object"), val, key, parent); |
| 755 | 755 | } |
| 756 | - const result: any = {}; | |
| 756 | + const result: any = Object.create(null); | |
| 757 | 757 | Object.getOwnPropertyNames(props).forEach(key => { |
| 758 | 758 | const prop = props[key]; |
| 759 | 759 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -764,7 +764,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 764 | 764 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 765 | 765 | } |
| 766 | 766 | }); |
| 767 | - return result; | |
| 767 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptnice-property-names-true--f4d7920ee2ce / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptprefer-const-values-true--6b26e4d1265c / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptprefer-unions-false--a5053c0a486d / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptprefer-unknown-false--f1ab9e45d823 / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptraw-type-any--474b307c39db / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptreadonly-true--24da4fc107df / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Mtypescriptruntime-typecheck-ignore-unknown-properties-true--d792c40f022e / TopLevel.ts+2 −2
| @@ -625,7 +625,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 625 | 625 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 626 | 626 | return invalidValue(l(ref || "object"), val, key, parent); |
| 627 | 627 | } |
| 628 | - const result: any = {}; | |
| 628 | + const result: any = Object.create(null); | |
| 629 | 629 | Object.getOwnPropertyNames(props).forEach(key => { |
| 630 | 630 | const prop = props[key]; |
| 631 | 631 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -636,7 +636,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 636 | 636 | result[key] = val[key]; |
| 637 | 637 | } |
| 638 | 638 | }); |
| 639 | - return result; | |
| 639 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/combined-enum.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/direct-recursive.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/empty-enum.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/identifiers.json
Mflowdefault / TopLevel.js+2 −2
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 139 | 139 | return invalidValue(l(ref || "object"), val, key, parent); |
| 140 | 140 | } |
| 141 | - const result: any = {}; | |
| 141 | + const result: any = Object.create(null); | |
| 142 | 142 | Object.getOwnPropertyNames(props).forEach(key => { |
| 143 | 143 | const prop = props[key]; |
| 144 | 144 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -149,7 +149,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 149 | 149 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 150 | 150 | } |
| 151 | 151 | }); |
| 152 | - return result; | |
| 152 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 136 | 136 | return invalidValue(l(ref || "object"), val, key, parent); |
| 137 | 137 | } |
| 138 | - const result: any = {}; | |
| 138 | + const result: any = Object.create(null); | |
| 139 | 139 | Object.getOwnPropertyNames(props).forEach(key => { |
| 140 | 140 | const prop = props[key]; |
| 141 | 141 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 147 | 147 | } |
| 148 | 148 | }); |
| 149 | - return result; | |
| 149 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/issue2680-object-array.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/issue2680-scalar-array.json
Mflowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/json/priority/keywords.json
Mflowdefault / TopLevel.js+2 −2
| @@ -1801,7 +1801,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1801 | 1801 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 1802 | 1802 | return invalidValue(l(ref || "object"), val, key, parent); |
| 1803 | 1803 | } |
| 1804 | - const result: any = {}; | |
| 1804 | + const result: any = Object.create(null); | |
| 1805 | 1805 | Object.getOwnPropertyNames(props).forEach(key => { |
| 1806 | 1806 | const prop = props[key]; |
| 1807 | 1807 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -1812,7 +1812,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1812 | 1812 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 1813 | 1813 | } |
| 1814 | 1814 | }); |
| 1815 | - return result; | |
| 1815 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | 1818 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -1799,7 +1799,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1799 | 1799 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 1800 | 1800 | return invalidValue(l(ref || "object"), val, key, parent); |
| 1801 | 1801 | } |
| 1802 | - const result: any = {}; | |
| 1802 | + const result: any = Object.create(null); | |
| 1803 | 1803 | Object.getOwnPropertyNames(props).forEach(key => { |
| 1804 | 1804 | const prop = props[key]; |
| 1805 | 1805 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -1810,7 +1810,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1810 | 1810 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 1811 | 1811 | } |
| 1812 | 1812 | }); |
| 1813 | - return result; | |
| 1813 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 1814 | 1814 | } |
| 1815 | 1815 | |
| 1816 | 1816 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -1799,7 +1799,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1799 | 1799 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 1800 | 1800 | return invalidValue(l(ref || "object"), val, key, parent); |
| 1801 | 1801 | } |
| 1802 | - const result: any = {}; | |
| 1802 | + const result: any = Object.create(null); | |
| 1803 | 1803 | Object.getOwnPropertyNames(props).forEach(key => { |
| 1804 | 1804 | const prop = props[key]; |
| 1805 | 1805 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -1810,7 +1810,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1810 | 1810 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 1811 | 1811 | } |
| 1812 | 1812 | }); |
| 1813 | - return result; | |
| 1813 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 1814 | 1814 | } |
| 1815 | 1815 | |
| 1816 | 1816 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/kotlin-enum-class-case-collision.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/list.json
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/name-style.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/nbl-stats.json
Mflowdefault / TopLevel.js+2 −2
| @@ -439,7 +439,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 439 | 439 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 440 | 440 | return invalidValue(l(ref || "object"), val, key, parent); |
| 441 | 441 | } |
| 442 | - const result: any = {}; | |
| 442 | + const result: any = Object.create(null); | |
| 443 | 443 | Object.getOwnPropertyNames(props).forEach(key => { |
| 444 | 444 | const prop = props[key]; |
| 445 | 445 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -450,7 +450,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 450 | 450 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 451 | 451 | } |
| 452 | 452 | }); |
| 453 | - return result; | |
| 453 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -384,7 +384,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 384 | 384 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 385 | 385 | return invalidValue(l(ref || "object"), val, key, parent); |
| 386 | 386 | } |
| 387 | - const result: any = {}; | |
| 387 | + const result: any = Object.create(null); | |
| 388 | 388 | Object.getOwnPropertyNames(props).forEach(key => { |
| 389 | 389 | const prop = props[key]; |
| 390 | 390 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -395,7 +395,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 395 | 395 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 396 | 396 | } |
| 397 | 397 | }); |
| 398 | - return result; | |
| 398 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/json/priority/nested-objects.json
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptconverters-all-objects--3a443babd1cb / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/no-classes.json
Mflowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/nst-test-suite.json
Mflowdefault / TopLevel.js+2 −2
| @@ -247,7 +247,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 247 | 247 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 248 | 248 | return invalidValue(l(ref || "object"), val, key, parent); |
| 249 | 249 | } |
| 250 | - const result: any = {}; | |
| 250 | + const result: any = Object.create(null); | |
| 251 | 251 | Object.getOwnPropertyNames(props).forEach(key => { |
| 252 | 252 | const prop = props[key]; |
| 253 | 253 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -258,7 +258,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 258 | 258 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 259 | 259 | } |
| 260 | 260 | }); |
| 261 | - return result; | |
| 261 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 245 | 245 | return invalidValue(l(ref || "object"), val, key, parent); |
| 246 | 246 | } |
| 247 | - const result: any = {}; | |
| 247 | + const result: any = Object.create(null); | |
| 248 | 248 | Object.getOwnPropertyNames(props).forEach(key => { |
| 249 | 249 | const prop = props[key]; |
| 250 | 250 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -255,7 +255,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 255 | 255 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 256 | 256 | } |
| 257 | 257 | }); |
| 258 | - return result; | |
| 258 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/number-map.json
Mflowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/omit-empty.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/optional-union.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/php-mixed-union.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/php-validation.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/recursive.json
Mflowdefault / TopLevel.js+2 −2
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 227 | 227 | return invalidValue(l(ref || "object"), val, key, parent); |
| 228 | 228 | } |
| 229 | - const result: any = {}; | |
| 229 | + const result: any = Object.create(null); | |
| 230 | 230 | Object.getOwnPropertyNames(props).forEach(key => { |
| 231 | 231 | const prop = props[key]; |
| 232 | 232 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -237,7 +237,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 237 | 237 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 238 | 238 | } |
| 239 | 239 | }); |
| 240 | - return result; | |
| 240 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -226,7 +226,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 226 | 226 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 227 | 227 | return invalidValue(l(ref || "object"), val, key, parent); |
| 228 | 228 | } |
| 229 | - const result: any = {}; | |
| 229 | + const result: any = Object.create(null); | |
| 230 | 230 | Object.getOwnPropertyNames(props).forEach(key => { |
| 231 | 231 | const prop = props[key]; |
| 232 | 232 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -237,7 +237,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 237 | 237 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 238 | 238 | } |
| 239 | 239 | }); |
| 240 | - return result; | |
| 240 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/simple-identifiers.json
Mflowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/union-constructor-clash.json
Mflowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/unions.json
Mflowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/url.json
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/priority/uuids.json
Mflowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/bitcoin-block.json
Mflowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/copy-with-property.json
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/getting-started.json
Mflowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/github-events.json
Mflowdefault / TopLevel.js+2 −2
| @@ -395,7 +395,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 395 | 395 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 396 | 396 | return invalidValue(l(ref || "object"), val, key, parent); |
| 397 | 397 | } |
| 398 | - const result: any = {}; | |
| 398 | + const result: any = Object.create(null); | |
| 399 | 399 | Object.getOwnPropertyNames(props).forEach(key => { |
| 400 | 400 | const prop = props[key]; |
| 401 | 401 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -406,7 +406,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 406 | 406 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 407 | 407 | } |
| 408 | 408 | }); |
| 409 | - return result; | |
| 409 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -393,7 +393,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 393 | 393 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 394 | 394 | return invalidValue(l(ref || "object"), val, key, parent); |
| 395 | 395 | } |
| 396 | - const result: any = {}; | |
| 396 | + const result: any = Object.create(null); | |
| 397 | 397 | Object.getOwnPropertyNames(props).forEach(key => { |
| 398 | 398 | const prop = props[key]; |
| 399 | 399 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -404,7 +404,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 404 | 404 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 405 | 405 | } |
| 406 | 406 | }); |
| 407 | - return result; | |
| 407 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/kitchen-sink.json
Mflowdefault / TopLevel.js+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 140 | 140 | return invalidValue(l(ref || "object"), val, key, parent); |
| 141 | 141 | } |
| 142 | - const result: any = {}; | |
| 142 | + const result: any = Object.create(null); | |
| 143 | 143 | Object.getOwnPropertyNames(props).forEach(key => { |
| 144 | 144 | const prop = props[key]; |
| 145 | 145 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -150,7 +150,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 150 | 150 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | - return result; | |
| 153 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/null-safe.json
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/objc-control-characters.json
Mflowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/json/samples/pokedex.json
Mflowdefault / TopLevel.js+2 −2
| @@ -159,7 +159,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 159 | 159 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 160 | 160 | return invalidValue(l(ref || "object"), val, key, parent); |
| 161 | 161 | } |
| 162 | - const result: any = {}; | |
| 162 | + const result: any = Object.create(null); | |
| 163 | 163 | Object.getOwnPropertyNames(props).forEach(key => { |
| 164 | 164 | const prop = props[key]; |
| 165 | 165 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -170,7 +170,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 170 | 170 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 171 | 171 | } |
| 172 | 172 | }); |
| 173 | - return result; | |
| 173 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Mtypescriptprefer-types-true--df33e18681f9 / TopLevel.ts+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/reddit.json
Mflowdefault / TopLevel.js+2 −2
| @@ -248,7 +248,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 248 | 248 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 249 | 249 | return invalidValue(l(ref || "object"), val, key, parent); |
| 250 | 250 | } |
| 251 | - const result: any = {}; | |
| 251 | + const result: any = Object.create(null); | |
| 252 | 252 | Object.getOwnPropertyNames(props).forEach(key => { |
| 253 | 253 | const prop = props[key]; |
| 254 | 254 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -259,7 +259,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 259 | 259 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 260 | 260 | } |
| 261 | 261 | }); |
| 262 | - return result; | |
| 262 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -233,7 +233,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 233 | 233 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 234 | 234 | return invalidValue(l(ref || "object"), val, key, parent); |
| 235 | 235 | } |
| 236 | - const result: any = {}; | |
| 236 | + const result: any = Object.create(null); | |
| 237 | 237 | Object.getOwnPropertyNames(props).forEach(key => { |
| 238 | 238 | const prop = props[key]; |
| 239 | 239 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -244,7 +244,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 244 | 244 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 245 | 245 | } |
| 246 | 246 | }); |
| 247 | - return result; | |
| 247 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/simple-object.json
Mflowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/spotify-album.json
Mflowdefault / TopLevel.js+2 −2
| @@ -177,7 +177,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 177 | 177 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 178 | 178 | return invalidValue(l(ref || "object"), val, key, parent); |
| 179 | 179 | } |
| 180 | - const result: any = {}; | |
| 180 | + const result: any = Object.create(null); | |
| 181 | 181 | Object.getOwnPropertyNames(props).forEach(key => { |
| 182 | 182 | const prop = props[key]; |
| 183 | 183 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -188,7 +188,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 188 | 188 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 189 | 189 | } |
| 190 | 190 | }); |
| 191 | - return result; | |
| 191 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -177,7 +177,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 177 | 177 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 178 | 178 | return invalidValue(l(ref || "object"), val, key, parent); |
| 179 | 179 | } |
| 180 | - const result: any = {}; | |
| 180 | + const result: any = Object.create(null); | |
| 181 | 181 | Object.getOwnPropertyNames(props).forEach(key => { |
| 182 | 182 | const prop = props[key]; |
| 183 | 183 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -188,7 +188,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 188 | 188 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 189 | 189 | } |
| 190 | 190 | }); |
| 191 | - return result; | |
| 191 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/us-avg-temperatures.json
Mflowdefault / TopLevel.js+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/json/samples/us-senators.json
Mflowdefault / TopLevel.js+2 −2
| @@ -212,7 +212,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 212 | 212 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 213 | 213 | return invalidValue(l(ref || "object"), val, key, parent); |
| 214 | 214 | } |
| 215 | - const result: any = {}; | |
| 215 | + const result: any = Object.create(null); | |
| 216 | 216 | Object.getOwnPropertyNames(props).forEach(key => { |
| 217 | 217 | const prop = props[key]; |
| 218 | 218 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -223,7 +223,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 223 | 223 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 224 | 224 | } |
| 225 | 225 | }); |
| 226 | - return result; | |
| 226 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if (typ === "any") return val; |
Mjavascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mtypescriptdefault / TopLevel.ts+2 −2
| @@ -189,7 +189,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 189 | 189 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 190 | 190 | return invalidValue(l(ref || "object"), val, key, parent); |
| 191 | 191 | } |
| 192 | - const result: any = {}; | |
| 192 | + const result: any = Object.create(null); | |
| 193 | 193 | Object.getOwnPropertyNames(props).forEach(key => { |
| 194 | 194 | const prop = props[key]; |
| 195 | 195 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -200,7 +200,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 200 | 200 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 201 | 201 | } |
| 202 | 202 | }); |
| 203 | - return result; | |
| 203 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/accessors.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/all-of-additional-properties-false.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/any.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/bool-string.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/boolean-subschema.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/camelCase.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/class-map-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 125 | 125 | return invalidValue(l(ref || "object"), val, key, parent); |
| 126 | 126 | } |
| 127 | - const result: any = {}; | |
| 127 | + const result: any = Object.create(null); | |
| 128 | 128 | Object.getOwnPropertyNames(props).forEach(key => { |
| 129 | 129 | const prop = props[key]; |
| 130 | 130 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 136 | 136 | } |
| 137 | 137 | }); |
| 138 | - return result; | |
| 138 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 125 | 125 | return invalidValue(l(ref || "object"), val, key, parent); |
| 126 | 126 | } |
| 127 | - const result: any = {}; | |
| 127 | + const result: any = Object.create(null); | |
| 128 | 128 | Object.getOwnPropertyNames(props).forEach(key => { |
| 129 | 129 | const prop = props[key]; |
| 130 | 130 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -135,7 +135,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 135 | 135 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 136 | 136 | } |
| 137 | 137 | }); |
| 138 | - return result; | |
| 138 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/class-with-additional.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/schema/comment-injection-enum-nested-comment.schema
Mcomment-injection-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 123 | 123 | return invalidValue(l(ref || "object"), val, key, parent); |
| 124 | 124 | } |
| 125 | - const result: any = {}; | |
| 125 | + const result: any = Object.create(null); | |
| 126 | 126 | Object.getOwnPropertyNames(props).forEach(key => { |
| 127 | 127 | const prop = props[key]; |
| 128 | 128 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -133,7 +133,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 133 | 133 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | - return result; | |
| 136 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/schema/comment-injection-enum.schema
Mcomment-injection-typescriptdefault / TopLevel.ts+2 −2
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 128 | 128 | return invalidValue(l(ref || "object"), val, key, parent); |
| 129 | 129 | } |
| 130 | - const result: any = {}; | |
| 130 | + const result: any = Object.create(null); | |
| 131 | 131 | Object.getOwnPropertyNames(props).forEach(key => { |
| 132 | 132 | const prop = props[key]; |
| 133 | 133 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 139 | 139 | } |
| 140 | 140 | }); |
| 141 | - return result; | |
| 141 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (typ === "any") return val; |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 129 | 129 | return invalidValue(l(ref || "object"), val, key, parent); |
| 130 | 130 | } |
| 131 | - const result: any = {}; | |
| 131 | + const result: any = Object.create(null); | |
| 132 | 132 | Object.getOwnPropertyNames(props).forEach(key => { |
| 133 | 133 | const prop = props[key]; |
| 134 | 134 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -139,7 +139,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 139 | 139 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 140 | 140 | } |
| 141 | 141 | }); |
| 142 | - return result; | |
| 142 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 128 | 128 | return invalidValue(l(ref || "object"), val, key, parent); |
| 129 | 129 | } |
| 130 | - const result: any = {}; | |
| 130 | + const result: any = Object.create(null); | |
| 131 | 131 | Object.getOwnPropertyNames(props).forEach(key => { |
| 132 | 132 | const prop = props[key]; |
| 133 | 133 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -138,7 +138,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 138 | 138 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 139 | 139 | } |
| 140 | 140 | }); |
| 141 | - return result; | |
| 141 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/schema/comment-injection-nested-comment.schema
Mcomment-injection-typescriptdefault / TopLevel.ts+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 120 | 120 | return invalidValue(l(ref || "object"), val, key, parent); |
| 121 | 121 | } |
| 122 | - const result: any = {}; | |
| 122 | + const result: any = Object.create(null); | |
| 123 | 123 | Object.getOwnPropertyNames(props).forEach(key => { |
| 124 | 124 | const prop = props[key]; |
| 125 | 125 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -130,7 +130,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 130 | 130 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 131 | 131 | } |
| 132 | 132 | }); |
| 133 | - return result; | |
| 133 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (typ === "any") return val; |
Test case
4 generated files · +8 −8test/inputs/schema/comment-injection.schema
Mcomment-injection-typescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 148 | 148 | return invalidValue(l(ref || "object"), val, key, parent); |
| 149 | 149 | } |
| 150 | - const result: any = {}; | |
| 150 | + const result: any = Object.create(null); | |
| 151 | 151 | Object.getOwnPropertyNames(props).forEach(key => { |
| 152 | 152 | const prop = props[key]; |
| 153 | 153 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -158,7 +158,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 158 | 158 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 159 | 159 | } |
| 160 | 160 | }); |
| 161 | - return result; | |
| 161 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/const-non-string.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/constructor.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/cut-enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/date-time-or-string.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/date-time.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/default-value.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/description-with-double-quotes.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/description.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -146,7 +146,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 146 | 146 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 147 | 147 | return invalidValue(l(ref || "object"), val, key, parent); |
| 148 | 148 | } |
| 149 | - const result: any = {}; | |
| 149 | + const result: any = Object.create(null); | |
| 150 | 150 | Object.getOwnPropertyNames(props).forEach(key => { |
| 151 | 151 | const prop = props[key]; |
| 152 | 152 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -157,7 +157,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 157 | 157 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 158 | 158 | } |
| 159 | 159 | }); |
| 160 | - return result; | |
| 160 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -144,7 +144,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 144 | 144 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 145 | 145 | return invalidValue(l(ref || "object"), val, key, parent); |
| 146 | 146 | } |
| 147 | - const result: any = {}; | |
| 147 | + const result: any = Object.create(null); | |
| 148 | 148 | Object.getOwnPropertyNames(props).forEach(key => { |
| 149 | 149 | const prop = props[key]; |
| 150 | 150 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -155,7 +155,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 155 | 155 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 156 | 156 | } |
| 157 | 157 | }); |
| 158 | - return result; | |
| 158 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/direct-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/empty-object.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/enum-large.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -136,7 +136,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 136 | 136 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 137 | 137 | return invalidValue(l(ref || "object"), val, key, parent); |
| 138 | 138 | } |
| 139 | - const result: any = {}; | |
| 139 | + const result: any = Object.create(null); | |
| 140 | 140 | Object.getOwnPropertyNames(props).forEach(key => { |
| 141 | 141 | const prop = props[key]; |
| 142 | 142 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -147,7 +147,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 147 | 147 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 148 | 148 | } |
| 149 | 149 | }); |
| 150 | - return result; | |
| 150 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/enum-with-null.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/enum-with-values.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 130 | 130 | return invalidValue(l(ref || "object"), val, key, parent); |
| 131 | 131 | } |
| 132 | - const result: any = {}; | |
| 132 | + const result: any = Object.create(null); | |
| 133 | 133 | Object.getOwnPropertyNames(props).forEach(key => { |
| 134 | 134 | const prop = props[key]; |
| 135 | 135 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -140,7 +140,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 140 | 140 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 141 | 141 | } |
| 142 | 142 | }); |
| 143 | - return result; | |
| 143 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 121 | 121 | return invalidValue(l(ref || "object"), val, key, parent); |
| 122 | 122 | } |
| 123 | - const result: any = {}; | |
| 123 | + const result: any = Object.create(null); | |
| 124 | 124 | Object.getOwnPropertyNames(props).forEach(key => { |
| 125 | 125 | const prop = props[key]; |
| 126 | 126 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -131,7 +131,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 131 | 131 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 132 | 132 | } |
| 133 | 133 | }); |
| 134 | - return result; | |
| 134 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/fractional-bounds.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/go-schema-pattern-properties.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/haskell-enum-forbidden.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/id-no-address.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/id-root.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/ie-suffix-singularization.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/implicit-all-of.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/implicit-class-array-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/implicit-one-of.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/integer-before-number.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/integer-float-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/integer-string.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/integer-type.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 117 | 117 | return invalidValue(l(ref || "object"), val, key, parent); |
| 118 | 118 | } |
| 119 | - const result: any = {}; | |
| 119 | + const result: any = Object.create(null); | |
| 120 | 120 | Object.getOwnPropertyNames(props).forEach(key => { |
| 121 | 121 | const prop = props[key]; |
| 122 | 122 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -127,7 +127,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 127 | 127 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 128 | 128 | } |
| 129 | 129 | }); |
| 130 | - return result; | |
| 130 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/intersection-nested.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/intersection.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/issue2680-top-level-array.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/keyword-enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -443,7 +443,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 443 | 443 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 444 | 444 | return invalidValue(l(ref || "object"), val, key, parent); |
| 445 | 445 | } |
| 446 | - const result: any = {}; | |
| 446 | + const result: any = Object.create(null); | |
| 447 | 447 | Object.getOwnPropertyNames(props).forEach(key => { |
| 448 | 448 | const prop = props[key]; |
| 449 | 449 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -454,7 +454,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 454 | 454 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 455 | 455 | } |
| 456 | 456 | }); |
| 457 | - return result; | |
| 457 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/keyword-unions.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -2100,7 +2100,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 2100 | 2100 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 2101 | 2101 | return invalidValue(l(ref || "object"), val, key, parent); |
| 2102 | 2102 | } |
| 2103 | - const result: any = {}; | |
| 2103 | + const result: any = Object.create(null); | |
| 2104 | 2104 | Object.getOwnPropertyNames(props).forEach(key => { |
| 2105 | 2105 | const prop = props[key]; |
| 2106 | 2106 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -2111,7 +2111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 2111 | 2111 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 2112 | 2112 | } |
| 2113 | 2113 | }); |
| 2114 | - return result; | |
| 2114 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 2115 | 2115 | } |
| 2116 | 2116 | |
| 2117 | 2117 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -1104,7 +1104,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1104 | 1104 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 1105 | 1105 | return invalidValue(l(ref || "object"), val, key, parent); |
| 1106 | 1106 | } |
| 1107 | - const result: any = {}; | |
| 1107 | + const result: any = Object.create(null); | |
| 1108 | 1108 | Object.getOwnPropertyNames(props).forEach(key => { |
| 1109 | 1109 | const prop = props[key]; |
| 1110 | 1110 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -1115,7 +1115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 1115 | 1115 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 1116 | 1116 | } |
| 1117 | 1117 | }); |
| 1118 | - return result; | |
| 1118 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 1121 | 1121 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/light.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/list.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/min-max-items.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -114,7 +114,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 114 | 114 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 115 | 115 | return invalidValue(l(ref || "object"), val, key, parent); |
| 116 | 116 | } |
| 117 | - const result: any = {}; | |
| 117 | + const result: any = Object.create(null); | |
| 118 | 118 | Object.getOwnPropertyNames(props).forEach(key => { |
| 119 | 119 | const prop = props[key]; |
| 120 | 120 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -125,7 +125,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 125 | 125 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | - return result; | |
| 128 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/minmax-integer.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/minmax.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/minmaxlength.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/multi-type-enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/mutually-recursive.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/nested-intersection-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/non-standard-ref.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/nullable-optional-one-of.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/object-type-required.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-any.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-const-ref.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-constraints.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-date-time.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/optional-property.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -107,7 +107,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 107 | 107 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 108 | 108 | return invalidValue(l(ref || "object"), val, key, parent); |
| 109 | 109 | } |
| 110 | - const result: any = {}; | |
| 110 | + const result: any = Object.create(null); | |
| 111 | 111 | Object.getOwnPropertyNames(props).forEach(key => { |
| 112 | 112 | const prop = props[key]; |
| 113 | 113 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 119 | 119 | } |
| 120 | 120 | }); |
| 121 | - return result; | |
| 121 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/pattern.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -115,7 +115,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 115 | 115 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 116 | 116 | return invalidValue(l(ref || "object"), val, key, parent); |
| 117 | 117 | } |
| 118 | - const result: any = {}; | |
| 118 | + const result: any = Object.create(null); | |
| 119 | 119 | Object.getOwnPropertyNames(props).forEach(key => { |
| 120 | 120 | const prop = props[key]; |
| 121 | 121 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 127 | 127 | } |
| 128 | 128 | }); |
| 129 | - return result; | |
| 129 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/postman-collection.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/prefix-items.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/recursive-union-flattening.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 122 | 122 | return invalidValue(l(ref || "object"), val, key, parent); |
| 123 | 123 | } |
| 124 | - const result: any = {}; | |
| 124 | + const result: any = Object.create(null); | |
| 125 | 125 | Object.getOwnPropertyNames(props).forEach(key => { |
| 126 | 126 | const prop = props[key]; |
| 127 | 127 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -132,7 +132,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 132 | 132 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 133 | 133 | } |
| 134 | 134 | }); |
| 135 | - return result; | |
| 135 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/ref-id-files.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/ref-remote.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/renaming-bug.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -210,7 +210,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 210 | 210 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 211 | 211 | return invalidValue(l(ref || "object"), val, key, parent); |
| 212 | 212 | } |
| 213 | - const result: any = {}; | |
| 213 | + const result: any = Object.create(null); | |
| 214 | 214 | Object.getOwnPropertyNames(props).forEach(key => { |
| 215 | 215 | const prop = props[key]; |
| 216 | 216 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -221,7 +221,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 221 | 221 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 222 | 222 | } |
| 223 | 223 | }); |
| 224 | - return result; | |
| 224 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -195,7 +195,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 195 | 195 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 196 | 196 | return invalidValue(l(ref || "object"), val, key, parent); |
| 197 | 197 | } |
| 198 | - const result: any = {}; | |
| 198 | + const result: any = Object.create(null); | |
| 199 | 199 | Object.getOwnPropertyNames(props).forEach(key => { |
| 200 | 200 | const prop = props[key]; |
| 201 | 201 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -206,7 +206,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 206 | 206 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 207 | 207 | } |
| 208 | 208 | }); |
| 209 | - return result; | |
| 209 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/required-draft3.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/required-non-properties.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/required.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/rust-cycle-breaker-union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/schema-constraints.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -109,7 +109,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 109 | 109 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 110 | 110 | return invalidValue(l(ref || "object"), val, key, parent); |
| 111 | 111 | } |
| 112 | - const result: any = {}; | |
| 112 | + const result: any = Object.create(null); | |
| 113 | 113 | Object.getOwnPropertyNames(props).forEach(key => { |
| 114 | 114 | const prop = props[key]; |
| 115 | 115 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -120,7 +120,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 120 | 120 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | - return result; | |
| 123 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/simple-ref.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/strict-optional.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/top-level-array.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -111,7 +111,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 111 | 111 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 112 | 112 | return invalidValue(l(ref || "object"), val, key, parent); |
| 113 | 113 | } |
| 114 | - const result: any = {}; | |
| 114 | + const result: any = Object.create(null); | |
| 115 | 115 | Object.getOwnPropertyNames(props).forEach(key => { |
| 116 | 116 | const prop = props[key]; |
| 117 | 117 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -122,7 +122,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 122 | 122 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 123 | 123 | } |
| 124 | 124 | }); |
| 125 | - return result; | |
| 125 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/top-level-enum.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/top-level-primitive-array.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -105,7 +105,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 105 | 105 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 106 | 106 | return invalidValue(l(ref || "object"), val, key, parent); |
| 107 | 107 | } |
| 108 | - const result: any = {}; | |
| 108 | + const result: any = Object.create(null); | |
| 109 | 109 | Object.getOwnPropertyNames(props).forEach(key => { |
| 110 | 110 | const prop = props[key]; |
| 111 | 111 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -116,7 +116,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 116 | 116 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 117 | 117 | } |
| 118 | 118 | }); |
| 119 | - return result; | |
| 119 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/top-level-primitive.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -108,7 +108,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 108 | 108 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 109 | 109 | return invalidValue(l(ref || "object"), val, key, parent); |
| 110 | 110 | } |
| 111 | - const result: any = {}; | |
| 111 | + const result: any = Object.create(null); | |
| 112 | 112 | Object.getOwnPropertyNames(props).forEach(key => { |
| 113 | 113 | const prop = props[key]; |
| 114 | 114 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -119,7 +119,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 119 | 119 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 120 | 120 | } |
| 121 | 121 | }); |
| 122 | - return result; | |
| 122 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/tuple.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/unevaluated-properties.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -126,7 +126,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 126 | 126 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 127 | 127 | return invalidValue(l(ref || "object"), val, key, parent); |
| 128 | 128 | } |
| 129 | - const result: any = {}; | |
| 129 | + const result: any = Object.create(null); | |
| 130 | 130 | Object.getOwnPropertyNames(props).forEach(key => { |
| 131 | 131 | const prop = props[key]; |
| 132 | 132 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -137,7 +137,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 137 | 137 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 138 | 138 | } |
| 139 | 139 | }); |
| 140 | - return result; | |
| 140 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 124 | 124 | return invalidValue(l(ref || "object"), val, key, parent); |
| 125 | 125 | } |
| 126 | - const result: any = {}; | |
| 126 | + const result: any = Object.create(null); | |
| 127 | 127 | Object.getOwnPropertyNames(props).forEach(key => { |
| 128 | 128 | const prop = props[key]; |
| 129 | 129 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -134,7 +134,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 134 | 134 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 135 | 135 | } |
| 136 | 136 | }); |
| 137 | - return result; | |
| 137 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/unicode-codepoint-length.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/union-int-double.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -110,7 +110,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 110 | 110 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 111 | 111 | return invalidValue(l(ref || "object"), val, key, parent); |
| 112 | 112 | } |
| 113 | - const result: any = {}; | |
| 113 | + const result: any = Object.create(null); | |
| 114 | 114 | Object.getOwnPropertyNames(props).forEach(key => { |
| 115 | 115 | const prop = props[key]; |
| 116 | 116 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -121,7 +121,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 121 | 121 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | - return result; | |
| 124 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/union-list.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -113,7 +113,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 113 | 113 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 114 | 114 | return invalidValue(l(ref || "object"), val, key, parent); |
| 115 | 115 | } |
| 116 | - const result: any = {}; | |
| 116 | + const result: any = Object.create(null); | |
| 117 | 117 | Object.getOwnPropertyNames(props).forEach(key => { |
| 118 | 118 | const prop = props[key]; |
| 119 | 119 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -124,7 +124,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 124 | 124 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 125 | 125 | } |
| 126 | 126 | }); |
| 127 | - return result; | |
| 127 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/union.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -112,7 +112,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 112 | 112 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 113 | 113 | return invalidValue(l(ref || "object"), val, key, parent); |
| 114 | 114 | } |
| 115 | - const result: any = {}; | |
| 115 | + const result: any = Object.create(null); | |
| 116 | 116 | Object.getOwnPropertyNames(props).forEach(key => { |
| 117 | 117 | const prop = props[key]; |
| 118 | 118 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -123,7 +123,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 123 | 123 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 124 | 124 | } |
| 125 | 125 | }); |
| 126 | - return result; | |
| 126 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/uuid.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -118,7 +118,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 118 | 118 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 119 | 119 | return invalidValue(l(ref || "object"), val, key, parent); |
| 120 | 120 | } |
| 121 | - const result: any = {}; | |
| 121 | + const result: any = Object.create(null); | |
| 122 | 122 | Object.getOwnPropertyNames(props).forEach(key => { |
| 123 | 123 | const prop = props[key]; |
| 124 | 124 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -129,7 +129,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 129 | 129 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 130 | 130 | } |
| 131 | 131 | }); |
| 132 | - return result; | |
| 132 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -117,7 +117,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 117 | 117 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 118 | 118 | return invalidValue(l(ref || "object"), val, key, parent); |
| 119 | 119 | } |
| 120 | - const result: any = {}; | |
| 120 | + const result: any = Object.create(null); | |
| 121 | 121 | Object.getOwnPropertyNames(props).forEach(key => { |
| 122 | 122 | const prop = props[key]; |
| 123 | 123 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -128,7 +128,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 128 | 128 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 129 | 129 | } |
| 130 | 130 | }); |
| 131 | - return result; | |
| 131 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (typ === "any") return val; |
Test case
3 generated files · +6 −6test/inputs/schema/vega-lite.schema
Mschema-flowdefault / TopLevel.js+2 −2
| @@ -6199,7 +6199,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 6199 | 6199 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 6200 | 6200 | return invalidValue(l(ref || "object"), val, key, parent); |
| 6201 | 6201 | } |
| 6202 | - const result: any = {}; | |
| 6202 | + const result: any = Object.create(null); | |
| 6203 | 6203 | Object.getOwnPropertyNames(props).forEach(key => { |
| 6204 | 6204 | const prop = props[key]; |
| 6205 | 6205 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -6210,7 +6210,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 6210 | 6210 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 6211 | 6211 | } |
| 6212 | 6212 | }); |
| 6213 | - return result; | |
| 6213 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 6214 | 6214 | } |
| 6215 | 6215 | |
| 6216 | 6216 | if (typ === "any") return val; |
Mschema-javascriptdefault / TopLevel.js+2 −2
| @@ -101,7 +101,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 101 | 101 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 102 | 102 | return invalidValue(l(ref || "object"), val, key, parent); |
| 103 | 103 | } |
| 104 | - const result = {}; | |
| 104 | + const result = Object.create(null); | |
| 105 | 105 | Object.getOwnPropertyNames(props).forEach(key => { |
| 106 | 106 | const prop = props[key]; |
| 107 | 107 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -112,7 +112,7 @@ function transform(val, typ, getProps, key = '', parent = '') { | ||
| 112 | 112 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 113 | 113 | } |
| 114 | 114 | }); |
| 115 | - return result; | |
| 115 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (typ === "any") return val; |
Mschema-typescriptdefault / TopLevel.ts+2 −2
| @@ -5956,7 +5956,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 5956 | 5956 | if (val === null || typeof val !== "object" || Array.isArray(val)) { |
| 5957 | 5957 | return invalidValue(l(ref || "object"), val, key, parent); |
| 5958 | 5958 | } |
| 5959 | - const result: any = {}; | |
| 5959 | + const result: any = Object.create(null); | |
| 5960 | 5960 | Object.getOwnPropertyNames(props).forEach(key => { |
| 5961 | 5961 | const prop = props[key]; |
| 5962 | 5962 | const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; |
| @@ -5967,7 +5967,7 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any | ||
| 5967 | 5967 | result[key] = transform(val[key], additional, getProps, key, ref); |
| 5968 | 5968 | } |
| 5969 | 5969 | }); |
| 5970 | - return result; | |
| 5970 | + return Object.setPrototypeOf(result, Object.prototype); | |
| 5971 | 5971 | } |
| 5972 | 5972 | |
| 5973 | 5973 | if (typ === "any") return val; |
No generated files match these filters.