bare-module 2.6.3 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +8 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -316,6 +316,10 @@ const Module = module.exports = exports = class Module {
316
316
  static load (specifier, source = null, opts = {}) {
317
317
  const self = Module
318
318
 
319
+ if (typeof specifier !== 'string') {
320
+ throw new TypeError(`Specifier must be a string. Received type ${typeof specifier} (${specifier})`)
321
+ }
322
+
319
323
  if (!ArrayBuffer.isView(source) && typeof source !== 'string' && source !== null) {
320
324
  opts = source
321
325
  source = null
@@ -383,6 +387,10 @@ const Module = module.exports = exports = class Module {
383
387
  static resolve (specifier, dirname = os.cwd(), opts = {}) {
384
388
  const self = Module
385
389
 
390
+ if (typeof specifier !== 'string') {
391
+ throw new TypeError(`Specifier must be a string. Received type ${typeof specifier} (${specifier})`)
392
+ }
393
+
386
394
  if (typeof dirname !== 'string') {
387
395
  opts = dirname
388
396
  dirname = os.cwd()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "description": "Module support for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [