From dab5a84d6f4c74a84bacc1a14e43bd6dd0075df9 Mon Sep 17 00:00:00 2001 From: cha0s Date: Wed, 27 Jan 2021 22:30:15 -0600 Subject: [PATCH] chore: tidy --- packages/core/src/resource-controllers/binary/index.jsx | 8 ++++---- packages/core/src/resource-controllers/text/index.jsx | 8 ++++---- packages/json/src/resource-controllers/json.jsx | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/core/src/resource-controllers/binary/index.jsx b/packages/core/src/resource-controllers/binary/index.jsx index 9631274..6433949 100644 --- a/packages/core/src/resource-controllers/binary/index.jsx +++ b/packages/core/src/resource-controllers/binary/index.jsx @@ -34,6 +34,10 @@ export default class BinaryController { ); } + static decode(encoded) { + return Buffer.from(encoded, 'base64'); + } + static encode(buffer) { return buffer.toString('base64'); } @@ -42,8 +46,4 @@ export default class BinaryController { return /.*/; } - static decode(encoded) { - return Buffer.from(encoded, 'base64'); - } - } diff --git a/packages/core/src/resource-controllers/text/index.jsx b/packages/core/src/resource-controllers/text/index.jsx index 67fb03e..3f545d2 100644 --- a/packages/core/src/resource-controllers/text/index.jsx +++ b/packages/core/src/resource-controllers/text/index.jsx @@ -19,6 +19,10 @@ export default class TextController { ); } + static decode(encoded) { + return Buffer.from(encoded, 'utf8'); + } + static encode(buffer) { return buffer.toString('utf8'); } @@ -27,8 +31,4 @@ export default class TextController { return /\.txt$/; } - static decode(encoded) { - return Buffer.from(encoded, 'utf8'); - } - } diff --git a/packages/json/src/resource-controllers/json.jsx b/packages/json/src/resource-controllers/json.jsx index 1765c92..8c382a0 100644 --- a/packages/json/src/resource-controllers/json.jsx +++ b/packages/json/src/resource-controllers/json.jsx @@ -55,6 +55,10 @@ export default class JsonController { ); } + static decode(encoded) { + return Buffer.from(JSON.stringify(encoded, null, 2), 'utf8'); + } + static encode(buffer) { return JSON.parse(buffer.toString('utf8')); } @@ -63,8 +67,4 @@ export default class JsonController { return /\.json$/; } - static decode(encoded) { - return Buffer.from(JSON.stringify(encoded, null, 2), 'utf8'); - } - }