Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

544 B
Raw Blame
import Foundation
import CoreFoundation

enum RemoteDesktopBridgeNumber {
  /// Expo's untyped JS dictionaries contain Double, not Swift Int. Keep the
  /// wire contract strict: no truncation, booleans or unsafe JS integers.
  static func integer(_ value: Any?) -> Int? {
    guard let number = value as? NSNumber,
          CFGetTypeID(number) != CFBooleanGetTypeID() else { return nil }
    let value = number.doubleValue
    guard value.isFinite, abs(value) <= 9_007_199_254_740_991 else { return nil }
    return Int(exactly: value)
  }
}