@@ -694,7 +694,7 @@ Returns `true` if the given `sandbox` object has been [contextified][] using
694694* ` code ` {string} The JavaScript code to compile and run.
695695* ` contextifiedSandbox ` {Object} The [ contextified] [ ] object that will be used
696696 as the ` global ` when the ` code ` is compiled and run.
697- * ` options `
697+ * ` options ` {Object|string}
698698 * ` filename ` {string} Specifies the filename used in stack traces produced
699699 by this script.
700700 * ` 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
713713access to the local scope. The ` contextifiedSandbox ` object * must* have been
714714previously [ contextified] [ ] using the [ ` vm.createContext() ` ] [ ] method.
715715
716+ If ` options ` is a string, then it specifies the filename.
717+
716718The following example compiles and executes different scripts using a single
717719[ contextified] [ ] object:
718720
@@ -739,7 +741,7 @@ added: v0.3.1
739741* ` code ` {string} The JavaScript code to compile and run.
740742* ` sandbox ` {Object} An object that will be [ contextified] [ ] . If ` undefined ` , a
741743 new object will be created.
742- * ` options `
744+ * ` options ` {Object|string}
743745 * ` filename ` {string} Specifies the filename used in stack traces produced
744746 by this script.
745747 * ` 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
767769within the context of the created context, then returns the result. Running code
768770does not have access to the local scope.
769771
772+ If ` options ` is a string, then it specifies the filename.
773+
770774The following example compiles and executes code that increments a global
771775variable and sets a new one. These globals are contained in the ` sandbox ` .
772776
@@ -791,7 +795,7 @@ added: v0.3.1
791795-->
792796
793797* ` code ` {string} The JavaScript code to compile and run.
794- * ` options `
798+ * ` options ` {Object|string}
795799 * ` filename ` {string} Specifies the filename used in stack traces produced
796800 by this script.
797801 * ` lineOffset ` {number} Specifies the line number offset that is displayed
@@ -809,6 +813,8 @@ added: v0.3.1
809813current ` global ` and returns the result. Running code does not have access to
810814local scope, but does have access to the current ` global ` object.
811815
816+ If ` options ` is a string, then it specifies the filename.
817+
812818The following example illustrates using both ` vm.runInThisContext() ` and
813819the JavaScript [ ` eval() ` ] [ ] function to run the same code:
814820
0 commit comments