Skip to content

Commit

Permalink
using default parameters instead the 'or' approach
Browse files Browse the repository at this point in the history
  • Loading branch information
rspecht committed Sep 29, 2015
1 parent b5bc00f commit 14baab7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/clipboard-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"');
Expand Down
3 changes: 1 addition & 2 deletions src/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 14baab7

Please sign in to comment.