lix-website/themes/lix/assets/bootstrap/node_modules/mdast-util-to-markdown/lib/configure.js

28 lines
635 B
JavaScript
Raw Normal View History

2024-04-27 03:39:10 +00:00
module.exports = configure
function configure(base, extension) {
var index = -1
var key
// First do subextensions.
if (extension.extensions) {
while (++index < extension.extensions.length) {
configure(base, extension.extensions[index])
}
}
for (key in extension) {
if (key === 'extensions') {
// Empty.
} else if (key === 'unsafe' || key === 'join') {
base[key] = base[key].concat(extension[key] || [])
} else if (key === 'handlers') {
base[key] = Object.assign(base[key], extension[key] || {})
} else {
base.options[key] = extension[key]
}
}
return base
}