-
Notifications
You must be signed in to change notification settings - Fork 69
chore: formatter.js es6 #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
Hi, I have a question on this. Why the formatter is required ? One of the functions is doing nothing, only returning the parameter. The tests keep passing when changing from: Cloudevent.prototype.format = function() {
// Check the constraints
this.spec.check();
// To run asData()
this.getData();
// Then, format
return this.formatter.format(this.spec.payload);
}; to Cloudevent.prototype.format = function() {
// Check the constraints
this.spec.check();
// To run asData()
this.getData();
// Then, format
return this.spec.payload;
}; And the toString function is basically calling the other toString function: Cloudevent.prototype.toString = function() {
return this.formatter.toString(this.spec.payload);
}; So why not to remove formatter directly ? Is that something required to have due specification or something ? |
Hi, I believe there are lots of files in this repo that aren't required. This PR simply updates the file to ES6. Perhaps we should create a bigger PR to remove unused pieces of code or simplifying files. |
Or small PRs to remove concise parts to be later easily traceable via git log 👍 |
@helio-frota good question. If I can speculate, I imagine this is a pattern so that the Your question exposes some things to think about. 1 Cloudevent.prototype.format = function() {
2 // Check the constraints
3 this.spec.check();
4
5 // To run asData()
6 this.getData();
7
8 // Then, format
9 return this.spec.payload;
10 }; On line 6, the call to It seems that the only format in use is JSON and there's no apparent way to ask for the data in any other format. So given that, maybe the The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - I will open an issue to continue the discussion around the overall code structure.
yeah, I've added a thumbs up on your comment to simplify the communication 😄 |
@grant minor nit - but I wouldn't call this a |
Ah, got it. Thanks for the FYI. |
Test PR to ensure tests work.