Skip to content

Commit c36f194

Browse files
authored
feat: formatter.js es6 (cloudevents#87)
Signed-off-by: Grant Timmerman <[email protected]>
1 parent bb8e0f9 commit c36f194

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

lib/formats/json/formatter.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
2-
function JSONFormatter() {
3-
1+
class JSONFormatter {
2+
/*
3+
* Every internal data structure is JSON by nature, so
4+
* no transformation is required
5+
*/
6+
format(payload) {
7+
return payload;
8+
}
9+
10+
toString(payload) {
11+
return JSON.stringify(payload);
12+
}
413
}
514

6-
/*
7-
* Every internal data structure is JSON by nature, so
8-
* no transformation is required
9-
*/
10-
JSONFormatter.prototype.format = function(payload) {
11-
return payload;
12-
};
13-
14-
JSONFormatter.prototype.toString = function(payload) {
15-
return JSON.stringify(payload);
16-
};
17-
1815
module.exports = JSONFormatter;

0 commit comments

Comments
 (0)