time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

SqDict.js (831B)


      1 import { vDict } from "../../value/index.js";
      2 import { SqDictValue, wrapValue } from "./index.js";
      3 export class SqDict {
      4     constructor(_value, context) {
      5         this._value = _value;
      6         this.context = context;
      7     }
      8     entries() {
      9         return [...this._value.entries()].map(([k, v]) => [
     10             k,
     11             wrapValue(v, this.context?.extend({ type: "string", value: k })),
     12         ]);
     13     }
     14     get(key) {
     15         const value = this._value.get(key);
     16         if (value === undefined) {
     17             return undefined;
     18         }
     19         return wrapValue(value, this.context?.extend({ type: "string", value: key }));
     20     }
     21     toString() {
     22         return vDict(this._value).toString();
     23     }
     24     asValue() {
     25         return new SqDictValue(vDict(this._value), this.context);
     26     }
     27 }
     28 //# sourceMappingURL=SqDict.js.map