Skip to content

CAI-js/python-eval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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 }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published