squiggle/packages/squiggle-lang/src/js/SqRecord.ts
2022-08-30 01:51:44 +04:00

16 lines
479 B
TypeScript

import * as RSRecord from "../rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Record.gen";
import { wrapValue } from "./SqValue";
import { SqValueLocation } from "./SqValueLocation";
type T = RSRecord.squiggleValue_Record;
export class SqRecord {
constructor(private _value: T, public location: SqValueLocation) {}
entries() {
return RSRecord.getKeyValuePairs(this._value).map(
([k, v]) => [k, wrapValue(v, this.location.extend(k))] as const
);
}
}