Skip to content

Conversation

@pm-Egor-Genning
Copy link

No description provided.

});

// tslint:disable-next-line
this.engine.registerHelper('concat', (...values) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why typescript without types?

lib/codegen.ts Outdated
}
});

this.engine.registerHelper('assign', function (varName, varValue, options) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure should be immutable. No assign allowed

lib/codegen.ts Outdated
});

this.engine.registerHelper('concat', (...values: string[]) => {
this.engine.registerHelper('if_eq', function(a, b, opts) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for? Use {#if (eq? a b)}

{{#case "application/json"}}
{{assign 'responseType' 'json'}}
{{/case}}
{{#case "text/csv"}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too strict should me some match against MIME top class

{{#if @first}}
{{#with (deref this)}}{{#first content}}{{#switch @key}}
{{#case "application/json"}}
{{assign 'responseType' 'json'}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need to have assign here. Just put two conditional blocks below:
one for including <any> and one for defining responseType

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants