Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Other: Remove if from _normalizeModelAttributeConfig().
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Mar 26, 2018
1 parent 2a6cab5 commit a70736a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/conversion/upcast-converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,17 +424,13 @@ function _normalizeViewAttributeKeyValueConfig( config ) {
// `config.model` is an `Object` with `key` and `value` properties.
//
// @param {Object} config Conversion config.
// @param {String} viewAttributeKeyToCopy Key of the converted view attribute. If it is set, model attribute value
// @param {String} viewAttributeKeyToCopy Key of the converted view attribute. If it is set, model attribute value
// will be equal to view attribute value.
function _normalizeModelAttributeConfig( config, viewAttributeKeyToCopy = null ) {
const defaultModelValue = viewAttributeKeyToCopy === null ? true : viewElement => viewElement.getAttribute( viewAttributeKeyToCopy );

const key = typeof config.model != 'object' ? config.model : config.model.key;
let value = typeof config.model != 'object' ? defaultModelValue : config.model.value;

if ( typeof value == 'undefined' ) {
value = defaultModelValue;
}
const value = typeof config.model != 'object' || typeof config.model.value == 'undefined' ? defaultModelValue : config.model.value;

config.model = { key, value };
}
Expand Down

0 comments on commit a70736a

Please sign in to comment.