We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c223e2 commit d042ef1Copy full SHA for d042ef1
lib/formats/base64.js
@@ -1,15 +1,16 @@
1
+class Base64Parser {
2
+ constructor(decorator) {
3
+ this.decorator = decorator;
4
+ }
5
-function Parser(decorator) {
- this.decorator = decorator;
-}
6
+ parse(payload) {
7
+ let payloadToParse = payload;
8
+ if (this.decorator) {
9
+ payloadToParse = this.decorator.parse(payload);
10
11
-Parser.prototype.parse = function(payload) {
- let toparse = payload;
- if (this.decorator) {
- toparse = this.decorator.parse(payload);
12
+ return Buffer.from(payloadToParse, "base64").toString();
13
}
14
+}
15
- return Buffer.from(toparse, "base64").toString();
-};
-
-module.exports = Parser;
16
+module.exports = Base64Parser;
0 commit comments