diff --git a/src/clipboard-action.js b/src/clipboard-action.js index ca228a7..21b05a8 100644 --- a/src/clipboard-action.js +++ b/src/clipboard-action.js @@ -140,8 +140,8 @@ class ClipboardAction { * Sets the `action` to be performed which can be either 'copy' or 'cut'. * @param {String} action */ - set action(action) { - this._action = action || 'copy'; + set action(action = 'copy') { + this._action = action; if (this._action !== 'copy' && this._action !== 'cut') { throw new Error('Invalid "action" value, use either "copy" or "cut"'); diff --git a/src/clipboard.js b/src/clipboard.js index e630001..f76122d 100644 --- a/src/clipboard.js +++ b/src/clipboard.js @@ -27,8 +27,7 @@ class Clipboard extends Emitter { * or a custom function that was passed in the constructor. * @param {Object} options */ - resolveOptions(options) { - options = options || {}; + resolveOptions(options = {}) { this.action = (typeof options.action === 'function') ? options.action : this.setAction; this.target = (typeof options.target === 'function') ? options.target : this.setTarget;