Skip to content

Commit

Permalink
Add new init for NonEmptyString
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaswkuipers committed Mar 5, 2024
1 parent 4c672a5 commit 33844f8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/SafeTypes/Collections/NonEmptyString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ public struct NonEmptyString {
}
self.characters = characters
}

public init?(repeating repeatedValue: Character, count: Int) {
guard let characters = NonEmptyArray(repeating: repeatedValue, count: count) else {
return nil
}
self.characters = characters
}
}

// MARK: - Array
Expand Down

0 comments on commit 33844f8

Please sign in to comment.