A way to use BType seamlessly in your Node project.
npm install --save btype-hook
require('btype-hook');
Just require()
BType files from your JavaScript.
# fib.bt
func int:main() {
func int:fib(int:n) {
if (n < 2) {
return n;
} else {
return fib(n - 1) + fib(n - 2);
}
}
return fib(10);
}
export main;
// index.js
// You only need to do this once.
require('btype-hook');
// Require a .bt file
var module = require('./myBTypeModule.bt');
// All of the exports are available on the module.
module.main(); // 55