Skip to content

Commit

Permalink
Merge pull request #4 from yassinebenaid/implement-sdump-and-sdumpnc
Browse files Browse the repository at this point in the history
Add `Sdump` and `SdumpNC`
  • Loading branch information
yassinebenaid authored Apr 2, 2024
2 parents f55f3ad + 4727429 commit a96f590
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions godump.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,20 @@ func DumpNC(v any) error {
}
return nil
}

// Sdump is just like Dump but returns the result instead of prining to STDOUT
func Sdump(v any) string {
d := dumper{}
d.dump(v)
d.buf.WriteByte(0xa)
return d.buf.String()
}

// Sdump is just like DumpNC but returns the result instead of prining to STDOUT
func SdumpNC(v any) string {
d := dumper{}
d.c.disabled = true
d.dump(v)
d.buf.WriteByte(0xa)
return d.buf.String()
}

0 comments on commit a96f590

Please sign in to comment.