1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use jrsonnet_evaluator::{function::builtin, IStr, Val};

#[builtin]
pub fn builtin_type(x: Val) -> IStr {
	x.value_type().name().into()
}

#[builtin]
pub fn builtin_is_string(v: Val) -> bool {
	matches!(v, Val::Str(_))
}
#[builtin]
pub fn builtin_is_number(v: Val) -> bool {
	matches!(v, Val::Num(_))
}
#[builtin]
pub fn builtin_is_boolean(v: Val) -> bool {
	matches!(v, Val::Bool(_))
}
#[builtin]
pub fn builtin_is_object(v: Val) -> bool {
	matches!(v, Val::Obj(_))
}
#[builtin]
pub fn builtin_is_array(v: Val) -> bool {
	matches!(v, Val::Arr(_))
}
#[builtin]
pub fn builtin_is_function(v: Val) -> bool {
	matches!(v, Val::Func(_))
}