build(aio): ensure the correct decorator properties are merged (#24289)

Previously only the `description` and `usageNotes` were being copied over
from the call-member of the decorator interface. Important properties such
as `shortDescription` were missed.

These are now added and the code has been refactored to make it simpler and
clearer to update which properties get copied as the requirements change.

PR Close #24289
This commit is contained in:
Pete Bacon Darwin
2018-06-04 11:43:15 +01:00
committed by Victor Berchet
parent acf270d724
commit 68d37ef0c1
5 changed files with 79 additions and 13 deletions

View File

@ -96,5 +96,19 @@ module.exports = {
attrMap[key] === false ? '' :
attrMap[key] === true ? ` ${key}` :
` ${key}="${attrMap[key].replace(/"/g, '"')}"`).join('');
}
},
/**
* Merge the specified properties from the source to the target document
* @param {Document} target The document to receive the properties from the source
* @param {Document} source The document from which to get the properties to merge
* @param {string[]} properties A collection of the names of the properties to merge
*/
mergeProperties(target, source, properties) {
properties.forEach(property => {
if (source.hasOwnProperty(property)) {
target[property] = source[property];
}
});
},
};