ChaiScript.js
JavaScript port of ChaiScript, an easy to use embedded scripting language, powered through Emscripten.
Node.js
npm init
npm install chaiscript --save
const chaiscript = require('chaiscript')
const chai = new chaiscript.ChaiScript()
const code = `
def hello(name) {
return "Hello " + name
}
var output = hello("Bob")
print(output)
`
chai.eval(code)
chai.delete()
API
new chaiscript.ChaiScript()
Create a new ChaiScript environment
.eval(string)
Executes the given code.
.evalString(string)
Executes the given code, and returns the output as a string.