Add index filter
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
struct HBMustacheContext: HBMustacheMethods {
|
||||
var first: Bool
|
||||
var last: Bool
|
||||
var index: Int
|
||||
|
||||
init(first: Bool = false, last: Bool = false) {
|
||||
self.first = first
|
||||
self.last = last
|
||||
self.index = 0
|
||||
}
|
||||
|
||||
func runMethod(_ name: String) -> Any? {
|
||||
@@ -14,6 +16,8 @@ struct HBMustacheContext: HBMustacheMethods {
|
||||
return self.first
|
||||
case "last":
|
||||
return self.last
|
||||
case "index":
|
||||
return self.index
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user