 
 
 // =============================================================================
-// MARK: - Value unwrapping
-
-extension MustacheBox {
-    
-    /**
-    If the boxed value is numerical (Swift numerical types, Bool, and NSNumber),
-    returns this value as an Int.
-    */
-    public var intValue: Int? {
-        return converter?.intValue?()
-    }
-    
-    /**
-    If the boxed value is numerical (Swift numerical types, Bool, and NSNumber),
-    returns this value as a UInt.
-    */
-    public var uintValue: UInt? {
-        return converter?.uintValue?()
-    }
-    
-    /**
-    If the boxed value is numerical (Swift numerical types, Bool, and NSNumber),
-    returns this value as a Double.
-    */
-    public var doubleValue: Double? {
-        return converter?.doubleValue?()
-    }
-    
-    /**
-    If boxed value can be iterated (Swift collection, NSArray, NSSet, etc.),
-    returns a [MustacheBox].
-    */
-    public var arrayValue: [MustacheBox]? {
-        return converter?.arrayValue?()
-    }
-    
-    /**
-    If boxed value is a dictionary (Swift dictionary, NSDictionary, etc.),
-    returns a [String: MustacheBox] dictionary.
-    */
-    public var dictionaryValue: [String: MustacheBox]? {
-        return converter?.dictionaryValue?()
-    }
-
-}
-
-
-// =============================================================================
 // MARK: - DebugPrintable
 
 extension MustacheBox : DebugPrintable {


extension MustacheBox {
    
    subscript(key: String) -> MustacheBox {
        return mustacheSubscript?(key: key) ?? Box()
    }
}

// =============================================================================
// MARK: - Boxing of Core Mustache functions

/**
A function that wraps a value and a SubscriptFunction into a MustacheBox.

It provides an easy way to let your custom types feed template engines:

::

  struct Person {
      let firstName: String
      let lastName: String
  }

  extension Person : MustacheBoxable {
      var mustacheBox: MustacheBox {
          // Return a Box that wraps our user, and exposes the `firstName`,
          // `lastName` and `fullName` to templates:
          return Box(value: self) { (key: String) in
              switch key {
              case "firstName":
                  return Box(self.firstName)
              case "lastName":
                  return Box(self.lastName)
              case "fullName":
                  return Box("\(self.firstName) \(self.lastName)")
              default:
                  return Box()
              }
          }
      }
  }

  // Renders "Tom Selleck"
  let template = Template(string: "{{person.fullName}}")!
  let person = Person(firstName: "Tom", lastName: "Selleck")
  template.render(Box(["person": Box(person)]))!

*/
public func Box(value: Any, mustacheSubscript: SubscriptFunction) -> MustacheBox {
    return MustacheBox(value: value, mustacheSubscript: mustacheSubscript)
}

/**
A function that wraps a FilterFunction into a MustacheBox.

::

  let square = Filter { (x: Int, _) in
      return Box(x * x)
  }

  let template = Template(string: "{{ square(x) }}")!
  template.registerInBaseContext("square", Box(square))

  // Renders "100"
  template.render(Box(["x": 10]))!
*/
public func Box(filter: FilterFunction) -> MustacheBox {
    return MustacheBox(filter: filter)
}

public func Box(value: Any? = nil, render: RenderFunction) -> MustacheBox {
