MCPcopy Create free account
hub / github.com/apache/fory / constructor

Method constructor

javascript/packages/core/lib/writer/index.ts:55–69  ·  view source on GitHub ↗
(config: {
    hps?: Hps;
  } = {})

Source from the content-addressed store, hash-verified

53 private writeNonEmptyStringWithHeader: (v: string) => void;
54
55 constructor(config: {
56 hps?: Hps;
57 } = {}) {
58 this.initPoll();
59 this.config = config;
60 this.hpsEnable = Boolean(config?.hps);
61 this.internalStringDetector = getInternalStringDetector();
62 if (this.hpsEnable) {
63 this.writeNonEmptyStringWithHeader = v => this.stringWithHeaderFast(v);
64 } else if (this.internalStringDetector !== null) {
65 this.writeNonEmptyStringWithHeader = v => this.stringWithHeaderWithDetector(v);
66 } else {
67 this.writeNonEmptyStringWithHeader = v => this.stringWithHeaderCompatibly(v);
68 }
69 }
70
71 private initPoll() {
72 this.byteLength = 1024 * 100;

Callers

nothing calls this directly

Calls 5

initPollMethod · 0.95
stringWithHeaderFastMethod · 0.95

Tested by

no test coverage detected