Files
bot/apps/macos/Sources/Bot/AnyCodable+Helpers.swift
zeekay 8c43edbae4 rebrand: complete openclaw → hanzo bot rename across all remaining files
Rename all openclaw/claw identifiers, file paths, docs, CI configs,
shell scripts, systemd units, Docker helpers, test fixtures, and
translation files. Remove stale clawdbot/clawhub paths. Fix pre-commit
hook for bash 3 compatibility (macOS). Zero openclaw or claw brand
references remain in the working tree.
2026-02-16 14:52:03 -08:00

44 lines
956 B
Swift

import Foundation
import BotKit
// Prefer the BotKit wrapper to keep gateway request payloads consistent.
typealias AnyCodable = BotKit.AnyCodable
typealias InstanceIdentity = BotKit.InstanceIdentity
extension AnyCodable {
var stringValue: String? {
self.value as? String
}
var boolValue: Bool? {
self.value as? Bool
}
var intValue: Int? {
self.value as? Int
}
var doubleValue: Double? {
self.value as? Double
}
var dictionaryValue: [String: AnyCodable]? {
self.value as? [String: AnyCodable]
}
var arrayValue: [AnyCodable]? {
self.value as? [AnyCodable]
}
var foundationValue: Any {
switch self.value {
case let dict as [String: AnyCodable]:
dict.mapValues { $0.foundationValue }
case let array as [AnyCodable]:
array.map(\.foundationValue)
default:
self.value
}
}
}