@caijs/python-eval

1.0.1 • Public • Published

@caijs/python-eval

Build Status Coverage Status NPM version NPM downloads

@caijs/eval includes a python transpiler and evaluator. It is intended for use in build scripts and code transformations, doing some evaluation at build time—it is NOT suitable for handling arbitrary untrusted user input. Malicious user input can execute arbitrary code.

Installation

In your project folder run:

$ npm install @caijs/python-eval

Examples of use

You can evaluate expressions

const { evaluate } = require('@caijs/python-eval');
const script = `
if n > 3:
  n += 1
n + 2
`;
const context = { n: 5 };
const actual = evaluate(script, context);
console.log(actual); // 8
console.log(context); // { n: 6 }

/@caijs/python-eval/

    Package Sidebar

    Install

    npm i @caijs/python-eval

    Weekly Downloads

    5

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    37.7 kB

    Total Files

    41

    Last publish

    Collaborators

    • jesus-seijas
    • jseijas