-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
55 lines (46 loc) · 3.46 KB
/
index.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/****************************************************************************************************************************************
# * index.js *
# **************************************************************************************************************************************
# * *
# * @License Starts *
# * *
# * Copyright © 2015 - present. MongoExpUser. All Rights Reserved. *
# * *
# * License: MIT - https://github.com/MongoExpUser/Debian-Based-NAPI-Rust-Addons/blob/main/LICENSE *
# * *
# * @License Ends *
# **************************************************************************************************************************************
# * *
# * Project: Rust Container Project for NAPI-Rust *
# * *
# * This index.js file creates a simple class to test: *
# * * *
# * 1) Invocation of a NAPI-Rust Addon modules from within Node.js *
# * *
# * *
# ***************************************************************************************************************************************/
class CallRust
{
constructor()
{
return null;
}
oilApiGravity(specificGravity)
{
const { api } = require("./callRust.node");
return api(specificGravity);
}
gammaDistributionFunction(a, x)
{
const { gdf } = require("./callRust.node");
return gdf(a, x);
}
}
(async function test()
{
const cr = new CallRust();
cr.oilApiGravity(1.01);
// value should be 8
cr.gammaDistributionFunction(0.01, 0.02);
// value should be 4.069063539262561
})();