1use super::{
2 bindings as napi,
3 raw::{Env, Local},
4};
5
6pub unsafe fn undefined(out: &mut Local, env: Env) {
8 napi::get_undefined(env, out as *mut Local).unwrap();
9}
10
11pub unsafe fn null(out: &mut Local, env: Env) {
13 napi::get_null(env, out as *mut Local).unwrap();
14}
15
16pub unsafe fn boolean(out: &mut Local, env: Env, b: bool) {
18 napi::get_boolean(env, b, out as *mut Local).unwrap();
19}
20
21pub unsafe fn boolean_value(env: Env, p: Local) -> bool {
24 let mut value = false;
25 assert_eq!(
26 napi::get_value_bool(env, p, &mut value as *mut bool),
27 Ok(())
28 );
29 value
30}
31
32pub unsafe fn number(out: &mut Local, env: Env, v: f64) {
35 napi::create_double(env, v, out as *mut Local).unwrap();
36}
37
38pub unsafe fn number_value(env: Env, p: Local) -> f64 {
41 let mut value = 0.0;
42 napi::get_value_double(env, p, &mut value as *mut f64).unwrap();
43 value
44}