From 2a7815c69cfb8d8e50864ad8591993406522af39 Mon Sep 17 00:00:00 2001 From: Adam Shannon Date: Tue, 18 Jan 2022 14:51:12 -0600 Subject: [PATCH] specs: add rightPadder Fixes: https://github.com/moov-io/iso8583/issues/155 --- specs/builder.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/specs/builder.go b/specs/builder.go index a6281eba..eb5704b0 100644 --- a/specs/builder.go +++ b/specs/builder.go @@ -76,8 +76,9 @@ var ( } PaddersIntToExt = map[string]string{ - "leftPadder": "Left", - "nonePadder": "None", + "leftPadder": "Left", + "rightPadder": "Right", + "nonePadder": "None", } PaddersExtToInt = map[string]func(pad string) padding.Padder{ @@ -87,6 +88,12 @@ var ( } return nil }, + "Right": func(pad string) padding.Padder { + if runes := []rune(pad); len(runes) == 1 { + return padding.Right(runes[0]) + } + return nil + }, "None": func(pad string) padding.Padder { return padding.None }, }