js object as constructor and module pattern