Skip to content

Commit

Permalink
TokenProvider.none
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Jan 26, 2024
1 parent 62ddf1b commit 749f584
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sources/Neon/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@ extension TokenApplication: ExpressibleByArrayLiteral {
}

public typealias TokenProvider = HybridValueProvider<NSRange, TokenApplication>

extension TokenProvider {
/// A TokenProvider that returns an empty set of tokens for all requests.
public static var none: TokenProvider {
.init(
syncValue: { _ in
return TokenApplication(tokens: [])
},
asyncValue: { _ in
return TokenApplication(tokens: [])
}
)
}
}

0 comments on commit 749f584

Please sign in to comment.