-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprimitives.cpp
More file actions
29 lines (22 loc) · 970 Bytes
/
primitives.cpp
File metadata and controls
29 lines (22 loc) · 970 Bytes
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
#include "primitives.hpp"
#include "util.hpp"
#include <napi_bind.hpp>
using napi_bind::ok;
using napi_bind::set_function;
napi_value create_primitives(napi_env env)
{
napi_value value;
ok(env, napi_create_object(env, &value));
set_function(env, value, "identity_bool", identity<bool>);
set_function(env, value, "identity_int8", identity<int8_t>);
set_function(env, value, "identity_int16", identity<int16_t>);
set_function(env, value, "identity_int32", identity<int32_t>);
set_function(env, value, "identity_int64", identity<int64_t>);
set_function(env, value, "identity_uint8", identity<uint8_t>);
set_function(env, value, "identity_uint16", identity<uint16_t>);
set_function(env, value, "identity_uint32", identity<uint32_t>);
set_function(env, value, "identity_uint64", identity<uint64_t>);
set_function(env, value, "identity_float", identity<float>);
set_function(env, value, "identity_double", identity<double>);
return value;
}