Files
swiftpm-mustache/Sources/HummingbirdMustache/Parent.swift
2021-03-14 10:19:51 +00:00

15 lines
308 B
Swift

protocol HBMustacheParent {
func child(named: String) -> Any?
}
extension HBMustacheParent {
// default child to nil
func child(named: String) -> Any? { return nil }
}
extension Dictionary: HBMustacheParent where Key == String {
func child(named: String) -> Any? { return self[named] }
}