 
 import Foundation
 
-public extension String {
-    
-    public var onlyNumbers: String {
-        let set = NSCharacterSet.decimalDigitCharacterSet().invertedSet
-        let numbers = self.componentsSeparatedByCharactersInSet(set)
-        return "".join(numbers)
-    }
-    
-}
-
-
 public class CreditCardValidator {
     
-    typealias T = CreditCardValidationType
+    public typealias T = CreditCardValidationType
     
     public lazy var types: [T] = {
         var types = [T]()

        return typeFromString(string) == type
    }
    
    // MARK: - Loading data

    private static let types = [
        [
            "name": "Amex",

    public func typeFromString(string: String) -> T? {
        for type in types {
            let predicate = NSPredicate(format: "SELF MATCHES %@", type.regex)
            let numbersString = self.onlyNumbersFromString(string)
            if predicate.evaluateWithObject(numbersString) {
                return type
            }
        }
