Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
next(
new Error('projectz: maintainers field must be array instead of CSV')
)
return this
}
// Validate license SPDX string
if (isObject(this.mergedPackageData.license)) {
next(
new Error(
'projectz: license field must now be a valid SPDX string: https://docs.npmjs.com/files/package.json#license'
)
)
return this
}
if (isObject(this.mergedPackageData.licenses)) {
next(
new Error(
'projectz: licenses field is deprecated, you must now use the license field as a valid SPDX string: https://docs.npmjs.com/files/package.json#license'
)
)
return this
}
// Validate package values
for (const name in this.mergedPackageData.packages) {
if (this.mergedPackageData.packages.hasOwnProperty(name)) {
const value = this.mergedPackageData.packages[name]
if (!isObject(value)) {
next(
new Error(
`projectz: custom package data for package ${name} must be an object`
next(
new Error(
'projectz: maintainer field is deprecated, use maintainers field'
)
)
return this
}
if (isString(this.mergedPackageData.maintainers)) {
next(
new Error('projectz: maintainers field must be array instead of CSV')
)
return this
}
// Validate license SPDX string
if (isObject(this.mergedPackageData.license)) {
next(
new Error(
'projectz: license field must now be a valid SPDX string: https://docs.npmjs.com/files/package.json#license'
)
)
return this
}
if (isObject(this.mergedPackageData.licenses)) {
next(
new Error(
'projectz: licenses field is deprecated, you must now use the license field as a valid SPDX string: https://docs.npmjs.com/files/package.json#license'
)
)
return this
}
return this
}
if (isObject(this.mergedPackageData.licenses)) {
next(
new Error(
'projectz: licenses field is deprecated, you must now use the license field as a valid SPDX string: https://docs.npmjs.com/files/package.json#license'
)
)
return this
}
// Validate package values
for (const name in this.mergedPackageData.packages) {
if (this.mergedPackageData.packages.hasOwnProperty(name)) {
const value = this.mergedPackageData.packages[name]
if (!isObject(value)) {
next(
new Error(
`projectz: custom package data for package ${name} must be an object`
)
)
return this
}
}
}
// ----------------------------------
// Merging
// Set some basic object defaults
extendr.defaults(this.mergedPackageData, {
badges: {},