def to_javascript(rule):
    to_js = _JavaScriptCompiler().compile
    result = ['(function(n) { return ']
    for tag, ast in PluralRule.parse(rule).abstract:
        result.append('%s ? %r : ' % (to_js(ast), tag))
    result.append('%r; })' % _fallback_tag)
    return ''.join(result)
Convert a list/dict of rules or a `PluralRule` object into a JavaScript
dataset/ETHPy150Open lad1337/XDM/site-packages/babel/plural.py/to_javascript