<commit_before>﻿{% if operation.HasFormParameters -%}
{%     if operation.ConsumesFormUrlEncoded -%}
let content_ = "";
{%         for parameter in operation.FormParameters -%}
{%             if parameter.IsRequired -%}
{%                 if parameter.IsNullable -%}
if ({{ parameter.VariableName }} === undefined)
    throw new Error("The parameter '{{ parameter.VariableName }}' must be defined.");
else
{%                 else -%}
if ({{ parameter.VariableName }} === undefined || {{ parameter.VariableName }} === null)
    throw new Error("The parameter '{{ parameter.VariableName }}' must be defined and cannot be null.");
else
{%                 endif -%}
{%             else -%}
{%                 if parameter.IsNullable -%}
if ({{ parameter.VariableName }} !== undefined)
{%                 else -%}
if ({{ parameter.VariableName }} === null)
    throw new Error("The parameter '{{ parameter.VariableName }}' cannot be null.");
else if ({{ parameter.VariableName }} !== undefined)
{%                 endif -%}
{%             endif -%}
{%             if parameter.IsDateArray -%}
    {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach(item_ => { content_ += encodeURIComponent("{{ parameter.Name }}") + "=" + encodeURIComponent(item_ ? "" + item_.toJSON() : "null") + "&"; });
{%             elseif parameter.IsObjectArray -%}
    {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach((item, index) => { 
        for (let attr in item)
			if (item.hasOwnProperty(attr)) {
				content_ += encodeURIComponent("{{ parameter.Name }}[" + index + "]." + attr) + "=" + encodeURIComponent("" + (<any>item)[attr]) + "&";
			}
    });
{%             elseif parameter.IsDate -%}<commit_msg>Improve TS template (avoid name clashes, remove tabs), https://github.com/RSuter/NSwag/pull/2022<commit_after>﻿{% if operation.HasFormParameters -%}
{%     if operation.ConsumesFormUrlEncoded -%}
let content_ = "";
{%         for parameter in operation.FormParameters -%}
{%             if parameter.IsRequired -%}
{%                 if parameter.IsNullable -%}
if ({{ parameter.VariableName }} === undefined)
    throw new Error("The parameter '{{ parameter.VariableName }}' must be defined.");
else
{%                 else -%}
if ({{ parameter.VariableName }} === undefined || {{ parameter.VariableName }} === null)
    throw new Error("The parameter '{{ parameter.VariableName }}' must be defined and cannot be null.");
else
{%                 endif -%}
{%             else -%}
{%                 if parameter.IsNullable -%}
if ({{ parameter.VariableName }} !== undefined)
{%                 else -%}
if ({{ parameter.VariableName }} === null)
    throw new Error("The parameter '{{ parameter.VariableName }}' cannot be null.");
else if ({{ parameter.VariableName }} !== undefined)
{%                 endif -%}
{%             endif -%}
{%             if parameter.IsDateArray -%}
    {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach(item_ => { content_ += encodeURIComponent("{{ parameter.Name }}") + "=" + encodeURIComponent(item_ ? "" + item_.toJSON() : "null") + "&"; });
{%             elseif parameter.IsObjectArray -%}
    {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach((item_, index_) => { 
        for (let attr_ in item_) {
           if (item_.hasOwnProperty(attr_)) {
                content_ += encodeURIComponent("{{ parameter.Name }}[" + index_ + "]." + attr_) + "=" + encodeURIComponent("" + (<any>item_)[attr_]) + "&";
           }
        }
    });
{%             elseif parameter.IsDate -%}
{'fraction_non_alphanumeric': 0.1808004478029667, 'fraction_numerical': 0.001119507416736636, 'mean_word_length': 2.61010101010101, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4628560', 'n_tokens_mistral': 1011, 'n_tokens_neox': 974, 'n_words': 220}