Refactor api, basestar & config to pure JS style