    * - If the string starts with multiple uppercase letters, lowercase those first letters up to the one before the last uppercase one
    * e.g. "PeoplePicker" gives "peoplePicker" but "URLChooser" gives "urlChooser"
    */
-  static func lowerFirstWord(value: Any?) -> Any? {
-    guard let string = value as? String else { return nil }
+  static func lowerFirstWord(value: Any?) throws -> Any? {
+    guard let string = value as? String else { throw FilterError.InvalidInputType }
     
     let cs = NSCharacterSet.uppercaseLetterCharacterSet()
     let scalars = string.unicodeScalars


import Stencil

struct IdentifierFilters {
  static func identifierNoUnderscores(value: Any?) -> Any? {
    guard let value = value as? String else { return nil }
    return swiftIdentifier(fromString: value, forbiddenChars: "_", replaceWithUnderscores: false)
  }
  
  static func identifierWithUnderscores(value: Any?) -> Any? {
    guard let value = value as? String else { return nil }
    return swiftIdentifier(fromString: value, replaceWithUnderscores: true)
  }
}

}

struct ArrayFilters {
  static func join(value: Any?) throws -> Any? {
    guard let array = value as? [String] else { throw FilterError.InvalidInputType }
    
    return array.joinWithSeparator(", ")
  }
