Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Better subscript functions. #8
Browse files Browse the repository at this point in the history
  • Loading branch information
calebd committed Nov 19, 2015
1 parent f0a421c commit e035967
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Alexander/JSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ public struct JSON {
}

public subscript(index: Int) -> JSON? {
let array = object as? [AnyObject]
return (array?[index]).map({ JSON(object: $0) })
return (arrayValue?[index]).map({ JSON(object: $0) })
}

public subscript(key: String) -> JSON? {
let dictionary = object as? [String: AnyObject]
return (dictionary?[key]).map({ JSON(object: $0) })
return (dictionaryValue?[key]).map({ JSON(object: $0) })
}

public var stringValue: String? {
Expand Down

0 comments on commit e035967

Please sign in to comment.