(props: {
context: ITypiaContext;
object: MetadataObjectType;
})
| 184 | }; |
| 185 | |
| 186 | const decode_object = (props: { |
| 187 | context: ITypiaContext; |
| 188 | object: MetadataObjectType; |
| 189 | }): ts.Statement[] => { |
| 190 | const input: ts.Identifier = ts.factory.createIdentifier("input"); |
| 191 | const output: ts.Identifier = ts.factory.createIdentifier("output"); |
| 192 | |
| 193 | return [ |
| 194 | ts.factory.createExpressionStatement( |
| 195 | ts.factory.createBinaryExpression( |
| 196 | input, |
| 197 | ts.factory.createToken(ts.SyntaxKind.EqualsToken), |
| 198 | ts.factory.createAsExpression( |
| 199 | ts.factory.createCallExpression( |
| 200 | props.context.importer.internal("httpQueryParseURLSearchParams"), |
| 201 | undefined, |
| 202 | [input], |
| 203 | ), |
| 204 | props.context.importer.type({ |
| 205 | file: "typia", |
| 206 | name: "IReadableURLSearchParams", |
| 207 | }), |
| 208 | ), |
| 209 | ), |
| 210 | ), |
| 211 | StatementFactory.constant({ |
| 212 | name: "output", |
| 213 | value: ts.factory.createObjectLiteralExpression( |
| 214 | props.object.properties.map((p) => |
| 215 | decode_regular_property({ |
| 216 | context: props.context, |
| 217 | property: p, |
| 218 | }), |
| 219 | ), |
| 220 | true, |
| 221 | ), |
| 222 | }), |
| 223 | ts.factory.createReturnStatement( |
| 224 | ts.factory.createAsExpression(output, TypeFactory.keyword("any")), |
| 225 | ), |
| 226 | ]; |
| 227 | }; |
| 228 | |
| 229 | const decode_regular_property = (props: { |
| 230 | context: ITypiaContext; |
no test coverage detected
searching dependent graphs…