import CottonValues import Foundation extension RecordValue { /// Nothing written: null, an empty list, or text that is only whitespace. static func isBlank(_ value: RecordValue) -> Bool { switch value { case .null: return true case .text(let s): return s.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty case .list(let l): return l.isEmpty default: return false } } /// Written and not a no: a value that is not blank and not `false`. static func isSet(_ value: RecordValue) -> Bool { value != .bool(false) && !isBlank(value) } }