1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 00:37:58 +01:00

use || short-circuit initialization idiom when processing Command and Map

constructor args
This commit is contained in:
Doug Kearns
2007-06-08 15:16:37 +00:00
parent 49c2b13d35
commit f6b000c6c4
2 changed files with 5 additions and 24 deletions

View File

@@ -122,21 +122,9 @@ function Command(specs, action, extra_info)//{{{
this.usage = this.name; this.usage = this.name;
} }
// TODO: ternary operator? this.help = extra_info.help || null;
if (extra_info.help) this.short_help = extra_info.short_help || null;
this.help = extra_info.help; this.completer = extra_info.completer || null;
else
this.help = null;
if (extra_info.short_help)
this.short_help = extra_info.short_help;
else
this.short_help = null;
if (extra_info.completer)
this.completer = extra_info.completer;
else
this.completer = null;
} }
}//}}} }//}}}

View File

@@ -24,15 +24,8 @@ function Map(mode, cmds, act, extra_info) //{{{
this.usage += " {arg}"; this.usage += " {arg}";
} }
if (extra_info.help) this.help = extra_info.help || null;
this.help = extra_info.help; this.short_help = extra_info.short_help || null;
else
this.help = null;
if (extra_info.short_help)
this.short_help = extra_info.short_help;
else
this.short_help = null;
} }
} }