Skip to content

Commit

Permalink
Add Delim()
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jul 19, 2021
1 parent f001ae3 commit 5fc619c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions koanf.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ func (ko *Koanf) MapKeys(path string) []string {
return out
}

// Delim returns delimiter in used by this instance of Koanf.
func (ko *Koanf) Delim() string {
return ko.conf.Delim
}

func (ko *Koanf) merge(c map[string]interface{}) error {
maps.IntfaceKeysToStrings(c)
if ko.conf.StrictMerge {
Expand Down
8 changes: 8 additions & 0 deletions koanf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ func TestLoadFileAllKeys(t *testing.T) {
}
}

func TestDelim(t *testing.T) {
k1 := koanf.New(".")
assert.Equal(t, k1.Delim(), ".")

k2 := koanf.New("/")
assert.Equal(t, k2.Delim(), "/")
}

func TestLoadMergeYamlJson(t *testing.T) {
var (
assert = assert.New(t)
Expand Down

0 comments on commit 5fc619c

Please sign in to comment.