[JS] Modularization

Review module construction for nodejs