• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

adnsistemas / pdf-lib / #18

24 Mar 2026 08:15PM UTC coverage: 74.286% (+0.3%) from 74.001%
#18

push

David N. Abdala
Documentation change

2569 of 3981 branches covered (64.53%)

Branch coverage included in aggregate %.

7372 of 9401 relevant lines covered (78.42%)

297170.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.12
/src/core/objects/PDFNumber.ts
1
import { PDFClasses } from '../../api/objects';
54✔
2
import { copyStringIntoBuffer, numberToString } from '../../utils/index';
54✔
3

4
import PDFObject from './PDFObject';
54✔
5

6
class PDFNumber extends PDFObject {
7
  static className = () => PDFClasses.PDFNumber;
4,931,450✔
8
  myClass(): PDFClasses {
9
    return PDFClasses.PDFNumber;
4,958,981✔
10
  }
11
  static of = (value: number) => new PDFNumber(value);
602,164✔
12

13
  private readonly numberValue: number;
14
  private readonly stringValue: string;
15

16
  private constructor(value: number) {
17
    super();
602,164✔
18
    this.numberValue = value;
602,164✔
19
    this.stringValue = numberToString(value);
602,164✔
20
  }
21

22
  asNumber(): number {
23
    return this.numberValue;
42,356✔
24
  }
25

26
  /** @deprecated in favor of [[PDFNumber.asNumber]] */
27
  value(): number {
28
    return this.numberValue;
×
29
  }
30

31
  clone(): PDFNumber {
32
    return PDFNumber.of(this.numberValue);
959✔
33
  }
34

35
  toString(): string {
36
    return this.stringValue;
677✔
37
  }
38

39
  sizeInBytes(): number {
40
    return this.stringValue.length;
36,949✔
41
  }
42

43
  copyBytesInto(buffer: Uint8Array, offset: number): number {
44
    copyStringIntoBuffer(this.stringValue, buffer, offset);
33,245✔
45
    return this.stringValue.length;
33,245✔
46
  }
47
}
48

49
export default PDFNumber;
54✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc