std:object
std:object
std:object provides explicit helpers for working with records.
import Object from 'std:object'Representative API
Object.spread = <T>(parts: T[]): TObject.keys = <T>(value: T): String[]Object.values = <T>(value: T): Unknown[]Object.entries = <T>(value: T): { key: String, value: Unknown }[]Object.has = <T>(key: String, value: T): BooleanObject.get = <T>(key: String, value: T): Unknown | NullObject.set = <T, V>(key: String, fieldValue: V, value: T): TExample
base = { id: '1', name: 'Ada' }next = Object.spread(base, { active: true })Notes
- record updates preserve immutability
Object.spreadshould merge left to right- dynamic-key helpers may be conservative at the type level in Draft 0.1
Comparison to JavaScript
This is the explicit alternative to object spread plus prototype-era habits. Records stay plain, and helpers stay imported.