@npmcli/config
Advanced tools
Comparing version 6.1.6 to 6.1.7
@@ -527,17 +527,24 @@ // TODO: set the scope config from package.json or explicit cli config | ||
const typeDesc = typeDescription(type) | ||
const oneOrMore = typeDesc.indexOf(Array) !== -1 | ||
const mustBe = typeDesc | ||
.filter(m => m !== undefined && m !== Array) | ||
const oneOf = mustBe.length === 1 && oneOrMore ? ' one or more' | ||
: mustBe.length > 1 && oneOrMore ? ' one or more of:' | ||
: mustBe.length > 1 ? ' one of:' | ||
: '' | ||
const msg = 'Must be' + oneOf | ||
const msg = 'Must be' + this.#getOneOfKeywords(mustBe, typeDesc) | ||
const desc = mustBe.length === 1 ? mustBe[0] | ||
: mustBe.filter(m => m !== Array) | ||
.map(n => typeof n === 'string' ? n : JSON.stringify(n)) | ||
.join(', ') | ||
: [...new Set(mustBe.map(n => typeof n === 'string' ? n : JSON.stringify(n)))].join(', ') | ||
log.warn('invalid config', msg, desc) | ||
} | ||
#getOneOfKeywords (mustBe, typeDesc) { | ||
let keyword | ||
if (mustBe.length === 1 && typeDesc.includes(Array)) { | ||
keyword = ' one or more' | ||
} else if (mustBe.length > 1 && typeDesc.includes(Array)) { | ||
keyword = ' one or more of:' | ||
} else if (mustBe.length > 1) { | ||
keyword = ' one of:' | ||
} else { | ||
keyword = '' | ||
} | ||
return keyword | ||
} | ||
#loadObject (obj, where, source, er = null) { | ||
@@ -544,0 +551,0 @@ // obj is the raw data read from the file |
{ | ||
"name": "@npmcli/config", | ||
"version": "6.1.6", | ||
"version": "6.1.7", | ||
"files": [ | ||
@@ -36,3 +36,3 @@ "bin/", | ||
"@npmcli/eslint-config": "^4.0.0", | ||
"@npmcli/template-oss": "4.12.1", | ||
"@npmcli/template-oss": "4.14.1", | ||
"tap": "^16.3.4" | ||
@@ -54,4 +54,4 @@ }, | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"version": "4.12.1" | ||
"version": "4.14.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50853
1123