JavaScript library for balanced ternary arithmetic