Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[typescript-fetch] Removed functions that are unused when withoutRuntime is true. #12101

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,12 @@ export interface RequestOpts {
body?: HTTPBody;
}

{{^withoutRuntimeChecks}}
export function exists(json: any, key: string) {
const value = json[key];
return value !== null && value !== undefined;
}
{{/withoutRuntimeChecks}}

export function querystring(params: HTTPQuery, prefix: string = ''): string {
return Object.keys(params)
Expand All @@ -238,12 +240,14 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string {
.join('&');
}

{{^withoutRuntimeChecks}}
export function mapValues(data: any, fn: (item: any) => any) {
return Object.keys(data).reduce(
(acc, key) => ({ ...acc, [key]: fn(data[key]) }),
{}
);
}
{{/withoutRuntimeChecks}}

export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,6 @@ export interface RequestOpts {
body?: HTTPBody;
}

export function exists(json: any, key: string) {
const value = json[key];
return value !== null && value !== undefined;
}

export function querystring(params: HTTPQuery, prefix: string = ''): string {
return Object.keys(params)
Expand All @@ -249,12 +245,6 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string {
.join('&');
}

export function mapValues(data: any, fn: (item: any) => any) {
return Object.keys(data).reduce(
(acc, key) => ({ ...acc, [key]: fn(data[key]) }),
{}
);
}

export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
Expand Down