MCPcopy Index your code
hub / github.com/foliojs/pdfkit / toString

Method toString

lib/tree.js:22–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 }
21
22 toString() {
23 // Needs to be sorted by key
24 const sortedKeys = Object.keys(this._items).sort((a, b) =>
25 this._compareKeys(a, b),
26 );
27
28 const out = ['<<'];
29 if (this.limits && sortedKeys.length > 1) {
30 const first = sortedKeys[0],
31 last = sortedKeys[sortedKeys.length - 1];
32 out.push(
33 ` /Limits ${PDFObject.convert([this._dataForKey(first), this._dataForKey(last)])}`,
34 );
35 }
36 out.push(` /${this._keysName()} [`);
37 for (let key of sortedKeys) {
38 out.push(
39 ` ${PDFObject.convert(this._dataForKey(key))} ${PDFObject.convert(
40 this._items[key],
41 )}`,
42 );
43 }
44 out.push(']');
45 out.push('>>');
46 return out.join('\n');
47 }
48
49 _compareKeys(/*a, b*/) {
50 throw new Error('Must be implemented by subclasses');

Callers 15

escapeNameFunction · 0.45
convertMethod · 0.45
readFileSyncMethod · 0.45
isEqualFunction · 0.45
encodeTextMethod · 0.45
toHexFunction · 0.45
encodeMethod · 0.45
vector.spec.jsFile · 0.45
crypto.spec.jsFile · 0.45
pdfa2.spec.jsFile · 0.45
pdfua.spec.jsFile · 0.45

Calls 5

_compareKeysMethod · 0.95
_dataForKeyMethod · 0.95
_keysNameMethod · 0.95
pushMethod · 0.80
convertMethod · 0.80

Tested by

no test coverage detected