| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Rewrites and multiplies the given renderings of type T. | 
					
						
							|  |  |  |  *  | 
					
						
							|  |  |  |  * For example: | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ```
 | 
					
						
							|  |  |  |  * { | 
					
						
							|  |  |  |  *     rewrite: { | 
					
						
							|  |  |  |  *         sourceString: ["key", "a|b|c"], | 
					
						
							|  |  |  |  *         into: [ | 
					
						
							| 
									
										
										
										
											2022-04-03 02:37:31 +02:00
										 |  |  |  *             ["X", 0] | 
					
						
							|  |  |  |  *             ["Y", 1], | 
					
						
							|  |  |  |  *             ["Z", 2] | 
					
						
							| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  |  *         ], | 
					
						
							|  |  |  |  *         renderings: { | 
					
						
							|  |  |  |  *             "key":"a|b|c" | 
					
						
							|  |  |  |  *         } | 
					
						
							|  |  |  |  *     } | 
					
						
							|  |  |  |  * } | 
					
						
							|  |  |  |  * ```
 | 
					
						
							|  |  |  |  * will result in _three_ copies (as the values to rewrite into have three values, namely: | 
					
						
							|  |  |  |  *  | 
					
						
							|  |  |  |  * [ | 
					
						
							|  |  |  |  *   { | 
					
						
							|  |  |  |  *   // The first pair: key --> X, a|b|c --> 0
 | 
					
						
							|  |  |  |  *       "X": 0 | 
					
						
							|  |  |  |  *   }, | 
					
						
							|  |  |  |  *   { | 
					
						
							|  |  |  |  *       "Y": 1 | 
					
						
							|  |  |  |  *   }, | 
					
						
							|  |  |  |  *   { | 
					
						
							|  |  |  |  *       "Z": 2 | 
					
						
							|  |  |  |  *   } | 
					
						
							|  |  |  |  *  | 
					
						
							|  |  |  |  * ] | 
					
						
							|  |  |  |  *  | 
					
						
							| 
									
										
										
										
											2022-04-03 02:37:31 +02:00
										 |  |  |  * @see ExpandRewrite | 
					
						
							| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2022-02-28 17:17:38 +01:00
										 |  |  | export default interface RewritableConfigJson<T> { | 
					
						
							|  |  |  |     rewrite: { | 
					
						
							|  |  |  |         sourceString: string[], | 
					
						
							|  |  |  |         into: (string | any)[][] | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     renderings: T | 
					
						
							|  |  |  | } |