Skip to content

Commit

Permalink
typings: lib/internal/vm.js
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyBooth committed Oct 10, 2023
1 parent a0a5b75 commit 1999445
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/internal/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,35 @@ const {
ERR_INVALID_ARG_TYPE,
} = require('internal/errors').codes;

/**
* Checks if the given object is a context object.
* @param {object} object - The object to check.
* @returns {boolean} - Returns true if the object is a context object, else false.
*/
function isContext(object) {
validateObject(object, 'object', kValidateObjectAllowArray);

return _isContext(object);
}

/**
* Compiles a function from the given code string.
* @param {string} code - The code string to compile.
* @param {string[]} [params] - An optional array of parameter names for the compiled function.
* @param {object} [options] - An optional object containing compilation options.
* @param {string} [options.filename=''] - The filename to use for the compiled function.
* @param {number} [options.columnOffset=0] - The column offset to use for the compiled function.
* @param {number} [options.lineOffset=0] - The line offset to use for the compiled function.
* @param {Buffer} [options.cachedData=undefined] - The cached data to use for the compiled function.
* @param {boolean} [options.produceCachedData=false] - Whether to produce cached data for the compiled function.
* @param {ReturnType<import('vm').createContext} [options.parsingContext=undefined] - The parsing context to use for the compiled function.

Check failure on line 48 in lib/internal/vm.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

This line has a length of 140. Maximum allowed is 120
* @param {object[]} [options.contextExtensions=[]] - An array of context extensions to use for the compiled function.
* @param {import('internal/modules/esm/utils').ImportModuleDynamicallyCallback} [options.importModuleDynamically] -
* A function to use for dynamically importing modules.
* @returns {object} An object containing the compiled function and any associated data.
* @throws {TypeError} If any of the arguments are of the wrong type.
* @throws {ERR_INVALID_ARG_TYPE} If the parsing context is not a valid context object.
*/
function internalCompileFunction(code, params, options) {
validateString(code, 'code');
if (params !== undefined) {
Expand Down

0 comments on commit 1999445

Please sign in to comment.