Skip to content

Commit 0b85d35

Browse files
Rename base64enc/dec to encode/decode.
There isn't any precedent for abbreviating words in the interpolation function names, and it may not be clear to all users what "enc" and "dec" are short for, so instead we'll prefer to spell out the whole words for improved readability.
1 parent b4e0a8e commit 0b85d35

3 files changed

Lines changed: 21 additions & 21 deletions

File tree

config/interpolate_funcs.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ var Funcs map[string]ast.Function
2020

2121
func init() {
2222
Funcs = map[string]ast.Function{
23-
"concat": interpolationFuncConcat(),
24-
"element": interpolationFuncElement(),
25-
"file": interpolationFuncFile(),
26-
"format": interpolationFuncFormat(),
27-
"formatlist": interpolationFuncFormatList(),
28-
"index": interpolationFuncIndex(),
29-
"join": interpolationFuncJoin(),
30-
"length": interpolationFuncLength(),
31-
"replace": interpolationFuncReplace(),
32-
"split": interpolationFuncSplit(),
33-
"base64enc": interpolationFuncBase64Encode(),
34-
"base64dec": interpolationFuncBase64Decode(),
23+
"concat": interpolationFuncConcat(),
24+
"element": interpolationFuncElement(),
25+
"file": interpolationFuncFile(),
26+
"format": interpolationFuncFormat(),
27+
"formatlist": interpolationFuncFormatList(),
28+
"index": interpolationFuncIndex(),
29+
"join": interpolationFuncJoin(),
30+
"length": interpolationFuncLength(),
31+
"replace": interpolationFuncReplace(),
32+
"split": interpolationFuncSplit(),
33+
"base64encode": interpolationFuncBase64Encode(),
34+
"base64decode": interpolationFuncBase64Decode(),
3535
}
3636
}
3737

@@ -396,8 +396,8 @@ func interpolationFuncValues(vs map[string]ast.Variable) ast.Function {
396396
}
397397
}
398398

399-
// interpolationFuncBase64Encode implements the "base64enc" function that allows
400-
// Base64 encoding.
399+
// interpolationFuncBase64Encode implements the "base64encode" function that
400+
// allows Base64 encoding.
401401
func interpolationFuncBase64Encode() ast.Function {
402402
return ast.Function{
403403
ArgTypes: []ast.Type{ast.TypeString},
@@ -409,8 +409,8 @@ func interpolationFuncBase64Encode() ast.Function {
409409
}
410410
}
411411

412-
// interpolationFuncBase64Decode implements the "base64dec" function that allows
413-
// Base64 decoding.
412+
// interpolationFuncBase64Decode implements the "base64decode" function that
413+
// allows Base64 decoding.
414414
func interpolationFuncBase64Decode() ast.Function {
415415
return ast.Function{
416416
ArgTypes: []ast.Type{ast.TypeString},

config/interpolate_funcs_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ func TestInterpolateFuncBase64Encode(t *testing.T) {
589589
Cases: []testFunctionCase{
590590
// Regular base64 encoding
591591
{
592-
`${base64enc("abc123!?$*&()'-=@~")}`,
592+
`${base64encode("abc123!?$*&()'-=@~")}`,
593593
"YWJjMTIzIT8kKiYoKSctPUB+",
594594
false,
595595
},
@@ -602,14 +602,14 @@ func TestInterpolateFuncBase64Decode(t *testing.T) {
602602
Cases: []testFunctionCase{
603603
// Regular base64 decoding
604604
{
605-
`${base64dec("YWJjMTIzIT8kKiYoKSctPUB+")}`,
605+
`${base64decode("YWJjMTIzIT8kKiYoKSctPUB+")}`,
606606
"abc123!?$*&()'-=@~",
607607
false,
608608
},
609609

610610
// Invalid base64 data decoding
611611
{
612-
`${base64dec("this-is-an-invalid-base64-data")}`,
612+
`${base64decode("this-is-an-invalid-base64-data")}`,
613613
nil,
614614
true,
615615
},

website/source/docs/configuration/interpolation.html.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ are documented below.
7474

7575
The supported built-in functions are:
7676

77-
* `base64dec(string)` - Given a base64-encoded string, decodes it and
77+
* `base64decode(string)` - Given a base64-encoded string, decodes it and
7878
returns the original string.
7979

80-
* `base64enc(string)` - Returns a base64-encoded representation of the
80+
* `base64encode(string)` - Returns a base64-encoded representation of the
8181
given string.
8282

8383
* `concat(list1, list2)` - Combines two or more lists into a single list.

0 commit comments

Comments
 (0)