feat(variable): Allow accessing dictionary count

This commit is contained in:
Yonas Kolb
2017-05-02 14:52:55 +08:00
committed by Kyle Fuller
parent 3180b26673
commit 14bac03990
3 changed files with 16 additions and 1 deletions

View File

@@ -74,7 +74,11 @@ public struct Variable : Equatable, Resolvable {
if let context = current as? Context {
current = context[bit]
} else if let dictionary = current as? [String: Any] {
current = dictionary[bit]
if bit == "count" {
current = dictionary.count
} else {
current = dictionary[bit]
}
} else if let array = current as? [Any] {
if let index = Int(bit) {
if index >= 0 && index < array.count {