JavaScript library with functional and object-oriented style