Skip to content

Commit

Permalink
Remove ArgOpts.stringArgs
Browse files Browse the repository at this point in the history
Args are always strings by default now. If integer/float parsing is desired it can be done via command middleware now or within the command body.
  • Loading branch information
zajrik committed Feb 23, 2017
1 parent a0a63bd commit 7bffdd5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/lib/command/Command.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ export default class Command
* @instance
*/
this.argOpts = info.argOpts || {};
this.argOpts.stringArgs = this.argOpts.stringArgs || false;
this.argOpts.separator = this.argOpts.separator || ' ';

/**
Expand Down Expand Up @@ -291,6 +290,5 @@ export default class Command
/**
* @typedef {Object} ArgOpts - Object containing options for
* controlling how command arguments will be parsed
* @property {boolean} stringArgs - Whether or not to parse all args as strings
* @property {string} [separator=' '] - The charactor to separate args by
*/
1 change: 0 additions & 1 deletion src/lib/command/CommandDispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export default class CommandDispatcher

let args = content.split(' ').slice(1).join(' ')
.split(command ? command.argOpts.separator : ' ')
.map(a => !isNaN(a) && command && !command.argOpts.stringArgs ? parseFloat(a) : a)
.map(a => typeof a === 'string' ? a.trim() : a)
.filter(a => a !== '' && !(typeof a !== 'string' && isNaN(a)));

Expand Down

0 comments on commit 7bffdd5

Please sign in to comment.