@@ -694,7 +694,7 @@ Returns `true` if the given `sandbox` object has been [contextified][] using
694
694
* ` code ` {string} The JavaScript code to compile and run.
695
695
* ` contextifiedSandbox ` {Object} The [ contextified] [ ] object that will be used
696
696
as the ` global ` when the ` code ` is compiled and run.
697
- * ` options `
697
+ * ` options ` {Object|string}
698
698
* ` filename ` {string} Specifies the filename used in stack traces produced
699
699
by this script.
700
700
* ` lineOffset ` {number} Specifies the line number offset that is displayed
@@ -713,6 +713,8 @@ the `contextifiedSandbox`, then returns the result. Running code does not have
713
713
access to the local scope. The ` contextifiedSandbox ` object * must* have been
714
714
previously [ contextified] [ ] using the [ ` vm.createContext() ` ] [ ] method.
715
715
716
+ If ` options ` is a string, then it specifies the filename.
717
+
716
718
The following example compiles and executes different scripts using a single
717
719
[ contextified] [ ] object:
718
720
@@ -739,7 +741,7 @@ added: v0.3.1
739
741
* ` code ` {string} The JavaScript code to compile and run.
740
742
* ` sandbox ` {Object} An object that will be [ contextified] [ ] . If ` undefined ` , a
741
743
new object will be created.
742
- * ` options `
744
+ * ` options ` {Object|string}
743
745
* ` filename ` {string} Specifies the filename used in stack traces produced
744
746
by this script.
745
747
* ` lineOffset ` {number} Specifies the line number offset that is displayed
@@ -767,6 +769,8 @@ creates a new `sandbox` if passed as `undefined`), compiles the `code`, runs it
767
769
within the context of the created context, then returns the result. Running code
768
770
does not have access to the local scope.
769
771
772
+ If ` options ` is a string, then it specifies the filename.
773
+
770
774
The following example compiles and executes code that increments a global
771
775
variable and sets a new one. These globals are contained in the ` sandbox ` .
772
776
@@ -791,7 +795,7 @@ added: v0.3.1
791
795
-->
792
796
793
797
* ` code ` {string} The JavaScript code to compile and run.
794
- * ` options `
798
+ * ` options ` {Object|string}
795
799
* ` filename ` {string} Specifies the filename used in stack traces produced
796
800
by this script.
797
801
* ` lineOffset ` {number} Specifies the line number offset that is displayed
@@ -809,6 +813,8 @@ added: v0.3.1
809
813
current ` global ` and returns the result. Running code does not have access to
810
814
local scope, but does have access to the current ` global ` object.
811
815
816
+ If ` options ` is a string, then it specifies the filename.
817
+
812
818
The following example illustrates using both ` vm.runInThisContext() ` and
813
819
the JavaScript [ ` eval() ` ] [ ] function to run the same code:
814
820
0 commit comments