From ba33e1c4a3d7c179244952c95a3a9ab1952e0107 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 28 Oct 2015 18:11:01 -0400 Subject: [PATCH] Ranges have a JSON property. --- prototype/Doubt/JSON.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/prototype/Doubt/JSON.swift b/prototype/Doubt/JSON.swift index adf5dd883..385e81b59 100644 --- a/prototype/Doubt/JSON.swift +++ b/prototype/Doubt/JSON.swift @@ -197,6 +197,15 @@ extension Array where Element: CustomJSONConvertible { } } +extension Range where Element: CustomJSONConvertible, Element.Distance: CustomJSONConvertible { + public var JSON: Doubt.JSON { + return [ + startIndex.JSON, + count.JSON, + ] + } +} + /// A type which can be converted to and from JSON. public protocol JSONConvertible: CustomJSONConvertible {