@@ -24,12 +24,35 @@ const {
24
24
ERR_INVALID_ARG_TYPE ,
25
25
} = require ( 'internal/errors' ) . codes ;
26
26
27
+ /**
28
+ * Checks if the given object is a context object.
29
+ * @param {object } object - The object to check.
30
+ * @returns {boolean } - Returns true if the object is a context object, else false.
31
+ */
27
32
function isContext ( object ) {
28
33
validateObject ( object , 'object' , kValidateObjectAllowArray ) ;
29
34
30
35
return _isContext ( object ) ;
31
36
}
32
37
38
+ /**
39
+ * Compiles a function from the given code string.
40
+ * @param {string } code - The code string to compile.
41
+ * @param {string[] } [params] - An optional array of parameter names for the compiled function.
42
+ * @param {object } [options] - An optional object containing compilation options.
43
+ * @param {string } [options.filename=''] - The filename to use for the compiled function.
44
+ * @param {number } [options.columnOffset=0] - The column offset to use for the compiled function.
45
+ * @param {number } [options.lineOffset=0] - The line offset to use for the compiled function.
46
+ * @param {Buffer } [options.cachedData=undefined] - The cached data to use for the compiled function.
47
+ * @param {boolean } [options.produceCachedData=false] - Whether to produce cached data for the compiled function.
48
+ * @param {ReturnType<import('vm').createContext } [options.parsingContext=undefined] - The parsing context to use for the compiled function.
49
+ * @param {object[] } [options.contextExtensions=[]] - An array of context extensions to use for the compiled function.
50
+ * @param {import('internal/modules/esm/utils').ImportModuleDynamicallyCallback } [options.importModuleDynamically] -
51
+ * A function to use for dynamically importing modules.
52
+ * @returns {object } An object containing the compiled function and any associated data.
53
+ * @throws {TypeError } If any of the arguments are of the wrong type.
54
+ * @throws {ERR_INVALID_ARG_TYPE } If the parsing context is not a valid context object.
55
+ */
33
56
function internalCompileFunction ( code , params , options ) {
34
57
validateString ( code , 'code' ) ;
35
58
if ( params !== undefined ) {
0 commit comments