Skip to content

Commit 6c105e1

Browse files
formatting
1 parent eefd826 commit 6c105e1

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

Sources/Hub/BinaryDistinct.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public struct BinaryDistinctString: Equatable, Hashable, Sendable, Comparable, C
3939
public init(_ str: String) {
4040
self.init(str as NSString)
4141
}
42-
42+
4343
public init(_ character: BinaryDistinctCharacter) {
4444
self.value = character.bytes
4545
}
46-
46+
4747
public init(_ characters: [BinaryDistinctCharacter]) {
4848
var data: [UInt16] = []
4949
for character in characters {
@@ -64,11 +64,11 @@ public struct BinaryDistinctString: Equatable, Hashable, Sendable, Comparable, C
6464
public static func < (lhs: BinaryDistinctString, rhs: BinaryDistinctString) -> Bool {
6565
return lhs.value.lexicographicallyPrecedes(rhs.value)
6666
}
67-
67+
6868
public static func + (lhs: BinaryDistinctString, rhs: BinaryDistinctString) -> BinaryDistinctString {
6969
return BinaryDistinctString(lhs.value + rhs.value)
7070
}
71-
71+
7272
public func hasPrefix(_ prefix: BinaryDistinctString) -> Bool {
7373
guard prefix.value.count <= self.value.count else { return false }
7474
return self.value.starts(with: prefix.value)
@@ -78,11 +78,11 @@ public struct BinaryDistinctString: Equatable, Hashable, Sendable, Comparable, C
7878
guard suffix.value.count <= self.value.count else { return false }
7979
return self.value.suffix(suffix.value.count) == suffix.value
8080
}
81-
81+
8282
public func lowercased() -> BinaryDistinctString {
8383
.init(self.string.lowercased())
8484
}
85-
85+
8686
public func replacingOccurrences(of: Self, with: Self) -> BinaryDistinctString {
8787
return BinaryDistinctString(self.string.replacingOccurrences(of: of.string, with: with.string))
8888
}
@@ -101,11 +101,11 @@ extension BinaryDistinctString {
101101
}
102102
return newIndex
103103
}
104-
104+
105105
public func index(_ i: Index, offsetBy distance: Int, limitedBy limit: Index) -> Index? {
106-
let newIndex = i + distance
107-
return newIndex <= limit ? newIndex : nil
108-
}
106+
let newIndex = i + distance
107+
return newIndex <= limit ? newIndex : nil
108+
}
109109
}
110110

111111
extension BinaryDistinctString: Sequence {
@@ -165,7 +165,7 @@ extension Dictionary where Key == BinaryDistinctString {
165165
public mutating func merge(_ other: [BinaryDistinctString: Value], strategy: (Value, Value) -> Value = { _, new in new }) {
166166
self.merge(other, uniquingKeysWith: strategy)
167167
}
168-
168+
169169
/// Merges a `[String: Value]` dictionary into this one
170170
public mutating func merge(_ other: [String: Value], strategy: (Value, Value) -> Value = { _, new in new }) {
171171
let converted = Dictionary(uniqueKeysWithValues: other.map { (BinaryDistinctString($0.key), $0.value) })
@@ -183,7 +183,7 @@ extension Dictionary where Key == BinaryDistinctString {
183183
newDict.merge(other, strategy: strategy)
184184
return newDict
185185
}
186-
186+
187187
public func merging(_ other: [BinaryDistinctString: Value], strategy: (Value, Value) -> Value = { _, new in new }) -> Self {
188188
var newDict = self
189189
newDict.merge(other, strategy: strategy)
@@ -222,7 +222,7 @@ public struct BinaryDistinctCharacter: Equatable, Hashable, CustomStringConverti
222222
public init(bytes: [UInt16]) {
223223
self.bytes = bytes
224224
}
225-
225+
226226
/// Satisfies ``ExpressibleByStringLiteral`` protocol.
227227
public init(stringLiteral value: String) {
228228
self.init(value)

Sources/Hub/Config.swift

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public struct Config: Hashable, Sendable,
6464
default:
6565
return false
6666
}
67-
67+
6868
// right hand side might be a super set of left hand side
6969
switch rhs {
7070
case .string(let rhs):
@@ -86,7 +86,7 @@ public struct Config: Hashable, Sendable,
8686
default:
8787
return false
8888
}
89-
89+
9090
return false
9191
}
9292

@@ -110,16 +110,14 @@ public struct Config: Hashable, Sendable,
110110
return "(\(val.0), \(val.1))"
111111
}
112112
}
113-
114-
113+
115114
public func string() -> String? {
116115
if case .string(let val) = self {
117116
return val.string
118117
}
119118
return nil
120119
}
121120

122-
123121
public func boolean() -> Bool? {
124122
if case .boolean(let val) = self {
125123
return val
@@ -139,14 +137,14 @@ public struct Config: Hashable, Sendable,
139137
}
140138
return nil
141139
}
142-
140+
143141
public func integer() -> Int? {
144142
if case .integer(let val) = self {
145143
return val
146144
}
147145
return nil
148146
}
149-
147+
150148
public func floating() -> Float? {
151149
if case .floating(let val) = self {
152150
return val
@@ -301,7 +299,7 @@ public struct Config: Hashable, Sendable,
301299
public func string() -> String? {
302300
return self.value.string()
303301
}
304-
302+
305303
public func string(or: String) -> String {
306304
if let val: String = self.string() {
307305
return val
@@ -344,7 +342,7 @@ public struct Config: Hashable, Sendable,
344342
public func boolean() -> Bool? {
345343
return self.value.boolean()
346344
}
347-
345+
348346
public func boolean(or: Bool) -> Bool {
349347
if let val = self.boolean() {
350348
return val
@@ -365,7 +363,7 @@ public struct Config: Hashable, Sendable,
365363
public func integer() -> Int? {
366364
return self.value.integer()
367365
}
368-
366+
369367
public func integer(or: Int) -> Int {
370368
if let val = self.integer() {
371369
return val
@@ -386,7 +384,7 @@ public struct Config: Hashable, Sendable,
386384
public func floating() -> Float? {
387385
return self.value.floating()
388386
}
389-
387+
390388
public func floating(or: Float) -> Float {
391389
if let val = self.value.floating() {
392390
return val
@@ -564,18 +562,17 @@ public struct Config: Hashable, Sendable,
564562
return Config()
565563
}
566564
}
567-
568-
565+
569566
public subscript(dynamicMember member: String) -> Config? {
570567
get {
571568
if let dict = self.dictionary() {
572569
return dict[BinaryDistinctString(member)] ?? dict[self.uncamelCase(BinaryDistinctString(member))] ?? Config()
573570
}
574571

575-
return nil // backward compatibility
572+
return nil // backward compatibility
576573
}
577-
}
578-
574+
}
575+
579576
public subscript(dynamicMember member: String) -> Config {
580577
get {
581578
if let dict = self.dictionary() {

0 commit comments

Comments
 (0)