Skip to content

Commit e8a0153

Browse files
authored
Merge pull request #1 from orchetect/dev
Removed `OTCore` as a dependency
2 parents a966846 + 9897435 commit e8a0153

File tree

5 files changed

+30
-11
lines changed

5 files changed

+30
-11
lines changed

Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ let package = Package(
1414
],
1515

1616
dependencies: [
17-
.package(url: "https://github.com/orchetect/OTCore", from: "1.1.10")
17+
// none
1818
],
1919

2020
targets: [
2121
.target(
2222
name: "TextFileKit",
23-
dependencies: ["OTCore"]),
23+
dependencies: []),
2424
.testTarget(
2525
name: "TextFileKitTests",
2626
dependencies: ["TextFileKit"])

Sources/TextFileKit/StringTable.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ extension StringTable {
4242
public subscript(safe row: Int, col: Int) -> Element.Element? {
4343

4444
get {
45-
self[safe: row]?[safe: col]
45+
guard self.indices.contains(row),
46+
self[row].indices.contains(col)
47+
else { return nil }
48+
49+
return self[row][col]
4650
}
4751
set {
4852
guard row < self.rowCount,

Sources/TextFileKit/TextFile CSV.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// TextFileKit • https://github.com/orchetect/TextFileKit
44
//
55

6-
@_implementationOnly import OTCore
6+
import Foundation
77

88
extension TextFile {
99

@@ -17,7 +17,7 @@ extension TextFile {
1717
// MARK: - Constants
1818

1919
internal static let sepChar: Character = ","
20-
internal static let newLineChar: Character = Character.newLine
20+
internal static let newLineChar: Character = "\n"
2121

2222
public static let fileExtension = "csv"
2323

@@ -57,10 +57,10 @@ extension TextFile {
5757
return outString
5858

5959
}
60-
.joined(separator: Self.sepChar.string)
60+
.joined(separator: String(Self.sepChar))
6161

6262
}
63-
.joined(separator: Self.newLineChar.string)
63+
.joined(separator: String(Self.newLineChar))
6464

6565
}
6666

Sources/TextFileKit/TextFile TSV.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// TextFileKit • https://github.com/orchetect/TextFileKit
44
//
55

6-
@_implementationOnly import OTCore
6+
import Foundation
77

88
extension TextFile {
99

@@ -15,7 +15,7 @@ extension TextFile {
1515
// MARK: - Constants
1616

1717
internal static let sepChar: Character = "\t"
18-
internal static let newLineChar: Character = Character.newLine
18+
internal static let newLineChar: Character = "\n"
1919

2020
public static let fileExtension = "tsv"
2121

@@ -64,10 +64,10 @@ extension TextFile {
6464
return outString
6565

6666
}
67-
.joined(separator: Self.sepChar.string)
67+
.joined(separator: String(Self.sepChar))
6868

6969
}
70-
.joined(separator: Self.newLineChar.string)
70+
.joined(separator: String(Self.newLineChar))
7171

7272
}
7373

Sources/TextFileKit/Utilities.swift

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Utilities.swift
3+
// TextFileKit • https://github.com/orchetect/TextFileKit
4+
//
5+
6+
import Foundation
7+
8+
extension String {
9+
10+
/// Wrap a string with double-quotes.
11+
@inlinable internal var quoted: Self {
12+
"\"\(self)\""
13+
}
14+
15+
}

0 commit comments

Comments
 (0)