forked from loafle/openapi-generator-original
		
	Fixes mapValues runtime inefficiency in typescript-fetch (#21047)
* fixes mapValues runtime inefficiency in typescript-fetch * adds regenerated typescript-fetch samples
This commit is contained in:
		
							parent
							
								
									047ceeaa45
								
							
						
					
					
						commit
						63afd455f7
					
				| @ -333,10 +333,11 @@ export function exists(json: any, key: string) { | |||||||
| 
 | 
 | ||||||
| {{^withoutRuntimeChecks}} | {{^withoutRuntimeChecks}} | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| {{/withoutRuntimeChecks}} | {{/withoutRuntimeChecks}} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
| @ -343,10 +343,11 @@ export function exists(json: any, key: string) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapValues(data: any, fn: (item: any) => any) { | export function mapValues(data: any, fn: (item: any) => any) { | ||||||
|   return Object.keys(data).reduce( |     const result: { [key: string]: any } = {}; | ||||||
|     (acc, key) => ({ ...acc, [key]: fn(data[key]) }), |     for (const key of Object.keys(data)) { | ||||||
|     {} |         result[key] = fn(data[key]); | ||||||
|   ); |     } | ||||||
|  |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function canConsumeForm(consumes: Consume[]): boolean { | export function canConsumeForm(consumes: Consume[]): boolean { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user