Skip to content

Commit a280623

Browse files
committed
typings: lib/internal/vm.js
1 parent a0a5b75 commit a280623

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lib/internal/vm.js

+24
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,36 @@ 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+
*/
2732
function 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
49+
* the compiled function.
50+
* @param {object[]} [options.contextExtensions=[]] - An array of context extensions to use for the compiled function.
51+
* @param {import('internal/modules/esm/utils').ImportModuleDynamicallyCallback} [options.importModuleDynamically] -
52+
* A function to use for dynamically importing modules.
53+
* @returns {object} An object containing the compiled function and any associated data.
54+
* @throws {TypeError} If any of the arguments are of the wrong type.
55+
* @throws {ERR_INVALID_ARG_TYPE} If the parsing context is not a valid context object.
56+
*/
3357
function internalCompileFunction(code, params, options) {
3458
validateString(code, 'code');
3559
if (params !== undefined) {

0 commit comments

Comments
 (0)