File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 11class Base64Parser {
2- constructor ( decorator ) {
2+ decorator : any ;
3+
4+ constructor ( decorator : any ) {
35 this . decorator = decorator ;
46 }
57
6- parse ( payload ) {
8+ parse ( payload : any ) : any {
79 let payloadToParse = payload ;
810 if ( this . decorator ) {
911 payloadToParse = this . decorator . parse ( payload ) ;
Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ class JSONFormatter {
33 * Every internal data structure is JSON by nature, so
44 * no transformation is required
55 */
6- format ( payload ) {
6+ format ( payload : any ) {
77 return payload ;
88 }
99
10- toString ( payload ) {
10+ toString ( payload : any ) {
1111 return JSON . stringify ( payload ) ;
1212 }
1313}
1414
15- module . exports = JSONFormatter ;
15+ export default JSONFormatter ;
Original file line number Diff line number Diff line change @@ -2,16 +2,17 @@ const {
22 isString,
33 isDefinedOrThrow,
44 isStringOrObjectOrThrow
5- } = require ( "../../bindings/http/validation/fun.js " ) ;
5+ } = require ( "../../bindings/http/validation/fun" ) ;
66const ValidationError = require ( "../../bindings/http/validation/validation_error.js" ) ;
77
88const invalidPayloadTypeError = new ValidationError ( "invalid payload type, allowed are: string or object" ) ;
99const nullOrUndefinedPayload = new ValidationError ( "null or undefined payload" ) ;
1010
11- const asJSON = ( v ) => ( isString ( v ) ? JSON . parse ( v ) : v ) ;
11+ const asJSON = ( v : object | string ) => ( isString ( v ) ? JSON . parse ( v as string ) : v ) ;
1212
1313class JSONParser {
14- constructor ( decorator ) {
14+ decorator : any
15+ constructor ( decorator : Base64Parser ) {
1516 this . decorator = decorator ;
1617 }
1718
@@ -20,7 +21,7 @@ class JSONParser {
2021 * @param {object|string } payload the JSON payload
2122 * @return {object } the parsed JSON payload.
2223 */
23- parse ( payload ) {
24+ parse ( payload : object | string ) {
2425 if ( this . decorator ) {
2526 payload = this . decorator . parse ( payload ) ;
2627 }
You can’t perform that action at this time.
0 commit comments