| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3d1dd96 commit 277d9da
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,6 @@ const { | |||
| 21 | 21 | const { isContext } = internalBinding('contextify'); | |
| 22 | 22 | const { | |
| 23 | 23 | isModuleNamespaceObject, | |
| 24 | - isArrayBufferView, | ||
| 25 | 24 | } = require('internal/util/types'); | |
| 26 | 25 | const { | |
| 27 | 26 | customInspectSymbol, | |
@@ -41,6 +40,7 @@ const { | |||
| 41 | 40 | } = require('internal/errors').codes; | |
| 42 | 41 | const { | |
| 43 | 42 | validateBoolean, | |
| 43 | + validateBuffer, | ||
| 44 | 44 | validateFunction, | |
| 45 | 45 | validateInt32, | |
| 46 | 46 | validateObject, | |
@@ -276,25 +276,16 @@ class SourceTextModule extends Module { | |||
| 276 | 276 | validateInt32(lineOffset, 'options.lineOffset'); | |
| 277 | 277 | validateInt32(columnOffset, 'options.columnOffset'); | |
| 278 | 278 | ||
| 279 | - if (initializeImportMeta !== undefined && | ||
| 280 | - typeof initializeImportMeta !== 'function') { | ||
| 281 | - throw new ERR_INVALID_ARG_TYPE( | ||
| 282 | - 'options.initializeImportMeta', 'function', initializeImportMeta); | ||
| 279 | + if (initializeImportMeta !== undefined) { | ||
| 280 | + validateFunction(initializeImportMeta, 'options.initializeImportMeta'); | ||
| 283 | 281 | } | |
| 284 | 282 | ||
| 285 | - if (importModuleDynamically !== undefined && | ||
| 286 | - typeof importModuleDynamically !== 'function') { | ||
| 287 | - throw new ERR_INVALID_ARG_TYPE( | ||
| 288 | - 'options.importModuleDynamically', 'function', | ||
| 289 | - importModuleDynamically); | ||
| 283 | + if (importModuleDynamically !== undefined) { | ||
| 284 | + validateFunction(importModuleDynamically, 'options.importModuleDynamically'); | ||
| 290 | 285 | } | |
| 291 | 286 | ||
| 292 | - if (cachedData !== undefined && !isArrayBufferView(cachedData)) { | ||
| 293 | - throw new ERR_INVALID_ARG_TYPE( | ||
| 294 | - 'options.cachedData', | ||
| 295 | - ['Buffer', 'TypedArray', 'DataView'], | ||
| 296 | - cachedData | ||
| 297 | - ); | ||
| 287 | + if (cachedData !== undefined) { | ||
| 288 | + validateBuffer(cachedData, 'options.cachedData'); | ||
| 298 | 289 | } | |
| 299 | 290 | ||
| 300 | 291 | super({ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments