123456789101112131415161718192021222324252627 |
- 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
- }
|