1.2.1 • Published 1 year ago
ghom-eval v1.2.1
ghom-eval
Install
npm install ghom-evalExample
Think of securing access because a malicious Eval can be devastating for your PC!
import { evaluate } from "ghom-eval" // or with CommonJS
evaluate("4 + 5")Returning
{
"class": "Number",
"type": "number",
"duration": 0,
"failed": false,
"input": "4 + 5",
"output": "9",
"evaluated": ";() => {\n return 4 + 5\n}\n"
}Options
evaluate method has 3 parameters.
- code
stringEvaluated code - context
anyContext value to inject in code (default:undefined) - contextName
stringThe access name of context (default:"context")
Enjoy!