Skip to content

Commit

Permalink
feat: allow custom alphabets with base57 encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
mack committed Sep 8, 2023
1 parent 868f0db commit af0a8cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shortuuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ func NewWithAlphabet(abc string) string {
enc := base57{newAlphabet(abc)}
return enc.Encode(uuid.New())
}

// WithAlphabet returns a new base57 enocder using the
// alternative alphabet abc.
func WithAlphabet(abc string) Encoder {
return base57{newAlphabet(abc)}
}

0 comments on commit af0a8cd

Please sign in to comment.