open-index/open-npm huggingface dataset:
npm package: @module-x/sandbox
Description: module-x sandbox
Latest version: 0.0.1

# @module-x/sandbox

Create a customized sandbox environment.

## API

```js
import { createSandbox } from "@module-x/sandbox";

const sandbox = createSandbox({
  // whether to include custom properties from host
  extendFromHost: false,
  host: window,
  useStrict: true,
  // custom rules
  rules: {},
});

// add custom rules to sandbox (optional)
sandbox.addRules({
  document: {
    rules: {
      defaultView: {
        get: () => sandbox.scope,
      },
    },
  },
});

const result = sandbox.evaluate(code);
console.log(`--- evaluate result ----`);
console.log(result);
```