duel-names
v1.2.0
Published
Duel round names mixin for Duel tournaments
Downloads
11
Readme
duel-names
A mixin module for Duel that puts roundName
function on the Duel
class prototype that outputs the normal english names for duel rounds. This is here, rather than inside the duel repository for easy internationalization.
Usage
Mixin with the Duel class:
var Duel = require('duel');
var duelNames = require('duel-names');
Duel.attachNames(duelNames(require('duel-names/english')));
var d = new Duel(4, { last: Duel.WB });
d.roundName(d.matches[3].id);
'Bronze Final';
d.roundName(d.matches[2].id);
'Grand Final'
You can pass in a full match id, or a partial Id. The id
must minimally contain { s: bracket, r: round }
.
Localizing
Add a language file, consider submitting it to this repo (but with tests please), or just maintain the language file yourself.
License
MIT-Licensed. See LICENSE file for details.