Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vm2

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vm2 - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

8

lib/sandbox.js

@@ -262,6 +262,6 @@ const {Script} = host.require('vm');

global.setTimeout = function(callback, ...args) {
global.setTimeout = function(callback, delay, ...args) {
let tmr = host.setTimeout(function() {
callback.apply(null, args)
});
}, delay);

@@ -277,6 +277,6 @@ let local = {

global.setInterval = function(callback, ...args) {
global.setInterval = function(callback, interval, ...args) {
let tmr = host.setInterval(function() {
callback.apply(null, args)
});
}, interval);

@@ -283,0 +283,0 @@ let local = {

@@ -16,3 +16,3 @@ {

],
"version": "3.0.0",
"version": "3.0.1",
"main": "index.js",

@@ -19,0 +19,0 @@ "repository": {

@@ -33,7 +33,26 @@ # vm2 [![NPM Version][npm-image]][npm-url] [![Package Quality][quality-image]][quality-url] [![Travis CI][travis-image]][travis-url]

const {VM} = require('vm2');
const vm = new VM();
const vm = new VM();
vm.run("process.exit()");
vm.run(`process.exit()`); // TypeError: process.exit is not a function
```
```javascript
const {NodeVM} = require('vm2');
const vm = new NodeVM({
require: {
external: true
}
});
vm.run(`
var request = require('request');
request('http://www.google.com', function (error, response, body) {
console.error(error);
if (!error && response.statusCode == 200) {
console.log(body) // Show the HTML for the Google homepage.
}
})
`, 'vm.js');
```
## Documentation

@@ -45,3 +64,3 @@

* [CLI](#cli)
* [2.x to 3.x changes](https://github.com/patriksimek/vm2/wiki/1.x-and-2.x-changes)
* [2.x to 3.x changes](https://github.com/patriksimek/vm2/wiki/2.x-to-3.x-changes)
* [1.x and 2.x docs](https://github.com/patriksimek/vm2/wiki/1.x-and-2.x-docs)

@@ -48,0 +67,0 @@ * [Contributing](https://github.com/patriksimek/vm2/wiki/Contributing)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc