npm-pkg-lint 5.1.2 → 5.1.3

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.
package/dist/index.js CHANGED
@@ -3452,11 +3452,14 @@ var require_tmp = __commonJS({
3452
3452
  ].join("");
3453
3453
  return path8.join(tmpDir, opts.dir, name);
3454
3454
  }
3455
- function _assertPath(path9) {
3456
- if (path9.includes("..")) {
3455
+ function _assertPath(option, value) {
3456
+ if (typeof value !== "string") {
3457
+ throw new Error(`${option} option must be a string, got "${typeof value}".`);
3458
+ }
3459
+ if (value.includes("..")) {
3457
3460
  throw new Error("Relative value not allowed");
3458
3461
  }
3459
- return path9;
3462
+ return value;
3460
3463
  }
3461
3464
  function _assertOptionsBase(options) {
3462
3465
  if (!_isUndefined(options.name)) {
@@ -3467,8 +3470,13 @@ var require_tmp = __commonJS({
3467
3470
  throw new Error(`name option must not contain a path, found "${name}".`);
3468
3471
  }
3469
3472
  }
3470
- if (!_isUndefined(options.template) && !options.template.match(TEMPLATE_PATTERN)) {
3471
- throw new Error(`Invalid template, found "${options.template}".`);
3473
+ if (!_isUndefined(options.template)) {
3474
+ if (typeof options.template !== "string") {
3475
+ throw new Error(`template option must be a string, got "${typeof options.template}".`);
3476
+ }
3477
+ if (!options.template.match(TEMPLATE_PATTERN)) {
3478
+ throw new Error(`Invalid template, found "${options.template}".`);
3479
+ }
3472
3480
  }
3473
3481
  if (!_isUndefined(options.tries) && isNaN(options.tries) || options.tries < 0) {
3474
3482
  throw new Error(`Invalid tries, found "${options.tries}".`);
@@ -3478,9 +3486,9 @@ var require_tmp = __commonJS({
3478
3486
  options.detachDescriptor = !!options.detachDescriptor;
3479
3487
  options.discardDescriptor = !!options.discardDescriptor;
3480
3488
  options.unsafeCleanup = !!options.unsafeCleanup;
3481
- options.prefix = _isUndefined(options.prefix) ? "" : _assertPath(options.prefix);
3482
- options.postfix = _isUndefined(options.postfix) ? "" : _assertPath(options.postfix);
3483
- options.template = _isUndefined(options.template) ? void 0 : _assertPath(options.template);
3489
+ options.prefix = _isUndefined(options.prefix) ? "" : _assertPath("prefix", options.prefix);
3490
+ options.postfix = _isUndefined(options.postfix) ? "" : _assertPath("postfix", options.postfix);
3491
+ options.template = _isUndefined(options.template) ? void 0 : _assertPath("template", options.template);
3484
3492
  }
3485
3493
  function _getRelativePath(option, name, tmpDir, cb) {
3486
3494
  if (_isUndefined(name)) return cb(null);