forked from fediversity/fediversity
		
	make template overrides chainable
This commit is contained in:
		
							parent
							
								
									67d00fea7e
								
							
						
					
					
						commit
						18864f2738
					
				
					 1 changed files with 14 additions and 1 deletions
				
			
		|  | @ -1,7 +1,20 @@ | |||
| { lib }: | ||||
| rec { | ||||
|   template = g: f: x: | ||||
|     (g (f x)) // { override = o: g (lib.recursiveUpdate (f x) o); }; | ||||
|     let | ||||
|       base = f x; | ||||
|       result = g base; | ||||
|     in | ||||
|     result // { | ||||
|       override = new: | ||||
|         let | ||||
|           base' = lib.recursiveUpdate base new; | ||||
|           result' = g base'; | ||||
|         in | ||||
|         result' // { | ||||
|           override = new: (template g (x': base') x).override new; | ||||
|         }; | ||||
|     }; | ||||
| 
 | ||||
|   /** | ||||
|     Recursively replace occurrences of `from` with `to` within `string` | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Valentin Gagarin
							Valentin Gagarin