feat: formatter.js es6 (#87)
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
This commit is contained in:
parent
bb8e0f9e0c
commit
c36f1949d0
|
@ -1,18 +1,15 @@
|
||||||
|
class JSONFormatter {
|
||||||
|
/*
|
||||||
|
* Every internal data structure is JSON by nature, so
|
||||||
|
* no transformation is required
|
||||||
|
*/
|
||||||
|
format(payload) {
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
function JSONFormatter() {
|
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;
|
module.exports = JSONFormatter;
|
||||||
|
|
Loading…
Reference in New Issue