Files
swiftpm-mustache/Sources/Mustache/Parent.swift
T. R. Bernstein 040862a0c0
Some checks failed
CI / macOS (push) Has been cancelled
CI / linux (swift:6.0) (push) Has been cancelled
CI / linux (swift:6.1) (push) Has been cancelled
CI / linux (swift:6.2) (push) Has been cancelled
CI / windows (6.1) (push) Has been cancelled
Adapt project for Astzweig
2025-09-29 14:28:48 +02:00

12 lines
406 B
Swift

/// Protocol for object that has a custom method for accessing their children, instead
/// of using Mirror
public protocol MustacheParent {
func child(named: String) -> Any?
}
/// Extend dictionary where the key is a string so that it uses the key values to access
/// it values
extension Dictionary: MustacheParent where Key == String {
public func child(named: String) -> Any? { self[named] }
}