Skip to content

Removed OTCore as a dependency #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ let package = Package(
],

dependencies: [
.package(url: "https://github.com/orchetect/OTCore", from: "1.1.10")
// none
],

targets: [
.target(
name: "TextFileKit",
dependencies: ["OTCore"]),
dependencies: []),
.testTarget(
name: "TextFileKitTests",
dependencies: ["TextFileKit"])
Expand Down
6 changes: 5 additions & 1 deletion Sources/TextFileKit/StringTable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ extension StringTable {
public subscript(safe row: Int, col: Int) -> Element.Element? {

get {
self[safe: row]?[safe: col]
guard self.indices.contains(row),
self[row].indices.contains(col)
else { return nil }

return self[row][col]
}
set {
guard row < self.rowCount,
Expand Down
8 changes: 4 additions & 4 deletions Sources/TextFileKit/TextFile CSV.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// TextFileKit • https://github.com/orchetect/TextFileKit
//

@_implementationOnly import OTCore
import Foundation

extension TextFile {

Expand All @@ -17,7 +17,7 @@ extension TextFile {
// MARK: - Constants

internal static let sepChar: Character = ","
internal static let newLineChar: Character = Character.newLine
internal static let newLineChar: Character = "\n"

public static let fileExtension = "csv"

Expand Down Expand Up @@ -57,10 +57,10 @@ extension TextFile {
return outString

}
.joined(separator: Self.sepChar.string)
.joined(separator: String(Self.sepChar))

}
.joined(separator: Self.newLineChar.string)
.joined(separator: String(Self.newLineChar))

}

Expand Down
8 changes: 4 additions & 4 deletions Sources/TextFileKit/TextFile TSV.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// TextFileKit • https://github.com/orchetect/TextFileKit
//

@_implementationOnly import OTCore
import Foundation

extension TextFile {

Expand All @@ -15,7 +15,7 @@ extension TextFile {
// MARK: - Constants

internal static let sepChar: Character = "\t"
internal static let newLineChar: Character = Character.newLine
internal static let newLineChar: Character = "\n"

public static let fileExtension = "tsv"

Expand Down Expand Up @@ -64,10 +64,10 @@ extension TextFile {
return outString

}
.joined(separator: Self.sepChar.string)
.joined(separator: String(Self.sepChar))

}
.joined(separator: Self.newLineChar.string)
.joined(separator: String(Self.newLineChar))

}

Expand Down
15 changes: 15 additions & 0 deletions Sources/TextFileKit/Utilities.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Utilities.swift
// TextFileKit • https://github.com/orchetect/TextFileKit
//

import Foundation

extension String {

/// Wrap a string with double-quotes.
@inlinable internal var quoted: Self {
"\"\(self)\""
}

}