Skip to content
Merged
Changes from 1 commit
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
Next Next commit
[typescript-fetch] remove unused function when withoutRuntimeCheks op…
…tion to true
  • Loading branch information
mkusaka committed Apr 9, 2022
commit f64e215f619cf5af3c984206557341cb199f5a8e
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