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

16 lines
451 B
TypeScript
Raw Normal View History

2022-08-27 17:46:43 +00:00
import * as RSArray from "../rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Array.gen";
2022-08-28 16:19:44 +00:00
import { wrapValue } from "./SqValue";
import { SqValueLocation } from "./SqValueLocation";
2022-08-27 17:46:43 +00:00
type T = RSArray.squiggleValue_Array;
2022-08-28 16:19:44 +00:00
export class SqArray {
constructor(private _value: T, public location: SqValueLocation) {}
2022-08-27 17:46:43 +00:00
getValues() {
return RSArray.getValues(this._value).map((v, i) =>
wrapValue(v, this.location.extend(i))
);
2022-08-27 17:46:43 +00:00
}
}