@@ -24,12 +24,35 @@ const {
2424 ERR_INVALID_ARG_TYPE ,
2525} = require ( 'internal/errors' ) . codes ;
2626
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+ */
2732function isContext ( object ) {
2833 validateObject ( object , 'object' , kValidateObjectAllowArray ) ;
2934
3035 return _isContext ( object ) ;
3136}
3237
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+ */
3356function internalCompileFunction ( code , params , options ) {
3457 validateString ( code , 'code' ) ;
3558 if ( params !== undefined ) {
0 commit comments