Skip to content

Commit

Permalink
Change single newline on mult-paragraph to double newline, since that…
Browse files Browse the repository at this point in the history
… is how a flow of paragraphs would actually be written, and makes more sense for testing actual content in things like TextEditor. (#27)
  • Loading branch information
garrettmurray authored Nov 3, 2024
1 parent 8942e73 commit a293c23
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Sources/LoremSwiftum.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,36 +99,36 @@ public final class Lorem {
/// Generates multiple paragraphs whose count is defined by the given value.
///
/// - Parameter count: The number of paragraphs to generate.
/// - Returns: The generated paragraphs joined by a new line character.
/// - Returns: The generated paragraphs joined by two new line characters.
public static func paragraphs(_ count: Int) -> String {
return _compose(
paragraph,
count: count,
joinBy: .newLine
joinBy: .doubleNewLine
)
}

/// Generates multiple paragraphs whose count is selected from within the given range.
///
/// - Parameter count: The number of paragraphs to generate.
/// - Returns: The generated paragraphs joined by a new line character.
/// - Returns: The generated paragraphs joined by two new line characters.
public static func paragraphs(_ range: Range<Int>) -> String {
return _compose(
paragraph,
count: Int.random(in: range),
joinBy: .newLine
joinBy: .doubleNewLine
)
}

/// Generates multiple paragraphs whose count is selected from within the given closed range.
///
/// - Parameter count: The number of paragraphs to generate.
/// - Returns: The generated paragraphs joined by a new line character.
/// - Returns: The generated paragraphs joined by a two new line characters.
public static func paragraphs(_ range: ClosedRange<Int>) -> String {
return _compose(
paragraph,
count: Int.random(in: range),
joinBy: .newLine
joinBy: .doubleNewLine
)
}

Expand Down Expand Up @@ -206,7 +206,7 @@ extension Lorem {
case none = ""
case space = " "
case dot = "."
case newLine = "\n"
case doubleNewLine = "\n\n"
}

fileprivate static func _compose(
Expand Down

0 comments on commit a293c23

Please sign in to comment.