Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch src/ to use ES classes (googleapis#158)
Fixes googleapis#85 - [x] Tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) --- This PR should be ready to go. I believe this requires a major semver bump. I figured the test files shouldn't be updated in the same PR. The only thing that really needs to be pointed out is that classes shouldn't be instantiatable without the new keyword: ```js const client1 = new Bigtable() const client2 = Bigtable() // Error: Class constructor Foo cannot be invoked without 'new' ``` I was on the fence about requiring people to use the `new` keyword or not, and chose to make it optional. I did this by using a proxy: ```js Bigtable = new Proxy(Bigtable, { apply(target, thisArg, argumentsList) { return new target(...argumentsList); }, }); ``` Let me know if this should be removed. I didn't add that to the semi-private classes since the common case of creating one is something like `instance.table(...)` and not `new Table(...)` Note - This was removed in review As before, most of this was done via lebab so there may be some issues so please do go through it again to make sure nothing terrible is being done.
- Loading branch information