squiggle/packages/squiggle-lang/src/js/SqRecord.ts

19 lines
402 B
TypeScript
Raw Normal View History

2022-08-27 17:46:43 +00:00
import * as RSRecord from "../rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Record.gen";
2022-08-28 16:19:44 +00:00
import { wrapValue } from "./SqValue";
2022-08-27 17:46:43 +00:00
type T = RSRecord.squiggleValue_Record;
2022-08-28 16:19:44 +00:00
export class SqRecord {
2022-08-27 17:46:43 +00:00
_value: T;
constructor(_value: T) {
this._value = _value;
}
entries() {
return RSRecord.getKeyValuePairs(this._value).map(
2022-08-28 16:19:44 +00:00
([k, v]) => [k, wrapValue(v)] as const
2022-08-27 17:46:43 +00:00
);
}
}