Renamed the Path+Functions extension in the library target as PathProvider.
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
enum Path {
|
||||
|
||||
// MARK: Functions
|
||||
|
||||
static func archivePath(from path: String) -> String {
|
||||
let pathComponents = path.split(separator: .forwardSlash)
|
||||
|
||||
return pathComponents.count > 1
|
||||
? .init(format: .Format.archiveDocC, String(pathComponents[1]))
|
||||
: .empty
|
||||
}
|
||||
|
||||
static func archiveName(from path: String) -> String {
|
||||
let pathComponents = path.split(separator: .forwardSlash)
|
||||
|
||||
return pathComponents.count > 1
|
||||
? .init(pathComponents[1]).lowercased()
|
||||
: .empty
|
||||
}
|
||||
|
||||
static func resourcePath(from path: String) -> String {
|
||||
let matches = path.matches(of: /\//)
|
||||
|
||||
return matches.count > 2
|
||||
? .init(path[matches[2].startIndex...])
|
||||
: .forwardSlash
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - String+Constants
|
||||
|
||||
extension String {
|
||||
static let empty = ""
|
||||
static let forwardSlash = "/"
|
||||
static let previousFolder = ".."
|
||||
}
|
||||
|
||||
// MARK: - Character+Constants
|
||||
|
||||
private extension Character {
|
||||
static let forwardSlash: Character = "/"
|
||||
}
|
||||
|
||||
// MARK: - String+Formats
|
||||
|
||||
private extension String.Format {
|
||||
static let archiveDocC = "/%@.doccarchive"
|
||||
}
|
||||
@@ -3,6 +3,8 @@ extension String {
|
||||
enum Format {
|
||||
/// A namespace that defines the format patterns used to generate relative path representations.
|
||||
enum Path {
|
||||
/// A representation of the format pattern used to generate relative paths that starts with the `/` string and finishes with the `.doccarchive` string.
|
||||
static let archive = "/%@.doccarchive"
|
||||
/// A representation of the format pattern used to generate relative paths that starts with the `/data` string.
|
||||
static let data = "/data/%@"
|
||||
/// A representation of the format pattern used to generate relative paths that starts with the `/docs` string.
|
||||
|
||||
Reference in New Issue
Block a user