-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Labels
coretype: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Milestone
Description
In addition to this:
dataset = new datastore.Dataset({
projectId: 'my-project',
keyFilename: '/path/to/keyfile.json'
});can we support (note the lack of the new keyword):
dataset = datastore.Dataset({
projectId: 'my-project',
keyFilename: '/path/to/keyfile.json'
});We can accomplish this by a technique discussed here.
Essentially detect whether the object calling it is an instance of Dataset or not:
if ( !(this instanceof Dataset) ) {
return new Dataset();
}If this change was to be made, I would suggest that developers omit new always and we don't document it as requiring it in the first place as it simplifies what the developer needs to worry about. The capitalization of Dataset implies its a constructor but they can call it just like a regular method on datastore.
Thoughts?
Metadata
Metadata
Assignees
Labels
coretype: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.