New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

evil-eval

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evil-eval

A JavaScript interpreter written in JavaScript.

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

evil-eval

A JavaScript interpreter written in JavaScript.

Why

Yout might working in a JavaScript environment where eval() and new Function() are not allowed (eg: WeChat Mini Program), and you probably have a good reason to use it.

Usage

import { runInContext } from 'evil-eval';

const code = `
    function hello(name) {
        return 'Hello ' + (name || defaultName) + '!';
    }

    module.exports = hello;
`;
const sandbox = { defaultName: 'World' };
const hello = runInContext(code, sandbox);
hello();

Inspired by

  • jsjs
  • vm.js

License

MIT

FAQs

Package last updated on 25 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts