Skip to content

Commit

Permalink
[typescript-fetch] Removed functions that are unused when withoutRunt…
Browse files Browse the repository at this point in the history
…ime is true. (#12101)

* [typescript-fetch] remove unused function when withoutRuntimeCheks option to true

* [typescript-fetch] update samples
  • Loading branch information
mkusaka authored Apr 13, 2022
1 parent f88024a commit 498ba58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,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 @@ -244,12 +246,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 @@ -228,10 +228,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 @@ -255,12 +251,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

0 comments on commit 498ba58

Please sign in to comment.