New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

context-eval

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

context-eval - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

20

lib/context-browser.js

@@ -7,6 +7,5 @@ function Context(sandbox, parentElement) {

var win = this.iframe.contentWindow;
sandbox = sandbox || {};
Object.keys(sandbox).forEach(function (key) {
win[key] = sandbox[key];
});
if (sandbox) {
this.extend(sandbox);
}
}

@@ -25,2 +24,13 @@

module.exports = Context;
Context.prototype.getGlobal = function () {
return this.iframe.contentWindow;
};
Context.prototype.extend = function (sandbox) {
var global = this.getGlobal();
Object.keys(sandbox).forEach(function (key) {
global[key] = sandbox[key];
});
};
module.exports = Context;

@@ -17,2 +17,12 @@ var vm = require('vm');

module.exports = Context;
Context.prototype.getGlobal = function () {
return this.context;
};
Context.prototype.extend = function (obj) {
Object.keys(obj).forEach(function(key) {
this.context[key] = obj[key];
}, this);
};
module.exports = Context;
{
"name": "context-eval",
"version": "0.0.2",
"version": "0.1.0",
"description": "JavaScript code execution context for the browser and wrapper around node vm module",
"main": "index.js",
"browser": "./lib/context-browser.js",
"scripts": {

@@ -7,0 +8,0 @@ "test": "mocha tests/"

@@ -36,5 +36,12 @@ # context-eval

## Context#extend(obj)
Extend the global object with `obj`
## Context#getGlobal()
Returns the global object
### License
MIT
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