node/deps/npm/lib/utils/config/describe-all.js
npm team dbc91de011
deps: upgrade npm to 8.0.0
PR-URL: https://github.com/nodejs/node/pull/40369
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2021-10-07 20:39:53 -04:00

21 lines
808 B
JavaScript

const definitions = require('./definitions.js')
const localeCompare = require('@isaacs/string-locale-compare')('en')
const describeAll = () => {
// sort not-deprecated ones to the top
/* istanbul ignore next - typically already sorted in the definitions file,
* but this is here so that our help doc will stay consistent if we decide
* to move them around. */
const sort = ([keya, {deprecated: depa}], [keyb, {deprecated: depb}]) => {
return depa && !depb ? 1
: !depa && depb ? -1
: localeCompare(keya, keyb)
}
return Object.entries(definitions).sort(sort)
.map(([key, def]) => def.describe())
.join(
'\n\n<!-- automatically generated, do not edit manually -->\n' +
'<!-- see lib/utils/config/definitions.js -->\n\n'
)
}
module.exports = describeAll