feat(tvix/eval): add builtins.isNull
Change-Id: Iae251d41b4ac6b77df56078a954ec3e33b7f9ccf Reviewed-on: https://cl.tvl.fyi/c/depot/+/6256 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
		
							parent
							
								
									b8ac62d5fc
								
							
						
					
					
						commit
						b41960c55e
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		|  | @ -17,6 +17,11 @@ macro_rules! builtin { | |||
| pub fn global_builtins() -> HashMap<&'static str, Value> { | ||||
|     let mut globals = HashMap::new(); | ||||
| 
 | ||||
|     builtin!(globals, "isNull", 1, |args| Ok(Value::Bool(matches!( | ||||
|         args[0], | ||||
|         Value::Null | ||||
|     )))); | ||||
| 
 | ||||
|     builtin!(globals, "toString", 1, |args| { | ||||
|         // TODO: toString is actually not the same as Display
 | ||||
|         Ok(Value::String(format!("{}", args[0]).into())) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue