Skip to content

Commit

Permalink
feat: formatter.js es6 (#87)
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
  • Loading branch information
grant authored Apr 29, 2020
1 parent bb8e0f9 commit c36f194
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions lib/formats/json/formatter.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@

function JSONFormatter() {

class JSONFormatter {
/*
* Every internal data structure is JSON by nature, so
* no transformation is required
*/
format(payload) {
return payload;
}

toString(payload) {
return JSON.stringify(payload);
}
}

/*
* Every internal data structure is JSON by nature, so
* no transformation is required
*/
JSONFormatter.prototype.format = function(payload) {
return payload;
};

JSONFormatter.prototype.toString = function(payload) {
return JSON.stringify(payload);
};

module.exports = JSONFormatter;

0 comments on commit c36f194

Please # to comment.