+//swiftlint:disable file_length
 import Foundation
 import KsApi
+import Prelude
 
 public enum Format {
-  // Number formatter for whole numbers.
-  private static let wholeNumberFormatter: NSNumberFormatter = {
-    let formatter = NSNumberFormatter()
-    formatter.numberStyle = .DecimalStyle
-    return formatter
-  }()
-
-  // Number formatter for whole numbers.
-  private static let percentageFormatter: NSNumberFormatter = {
-    let formatter = NSNumberFormatter()
-    formatter.numberStyle = .PercentStyle
-    formatter.roundingMode = .RoundDown
-    return formatter
-  }()
-
-  // Number formatter for fractions.
-  private static let percentageFractionFormatter: NSNumberFormatter = {
-    let formatter = NSNumberFormatter()
-    formatter.numberStyle = .PercentStyle
-    formatter.roundingMode = .RoundDown
-    formatter.maximumFractionDigits = 0
-    return formatter
-  }()
-
-  // Number formatter for currency.
-  private static let currencyFormatter: NSNumberFormatter = {
-    let formatter = NSNumberFormatter()
-    formatter.numberStyle = .CurrencyStyle
-    formatter.roundingMode = .RoundDown
-    formatter.maximumFractionDigits = 0
-    formatter.generatesDecimalNumbers = false
-    return formatter
-  }()
-
-  private static let dateFormatter = NSDateFormatter()
-
   /**
    Formats an int into a string.
 

}

private let defaultThresholdInDays = 30 // days

   - returns: A formatted string.
   */
  public static func percentage(percentage: Double, env: Environment = AppEnvironment.current) -> String {
    let formatter = NumberFormatterConfig.cachedFormatter(
      forConfig: .defaultPercentageConfig
        |> NumberFormatterConfig.lens.locale .~ env.locale
    )

    return formatter.stringFromNumber(Float(percentage)) ?? (String(percentage) + "%")
  }

  /**
