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:
@@ -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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}//}}}
|
}//}}}
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user