import { copyStringIntoBuffer , numberToString } from 'src/utils/index' ; import PDFObject from 'src/core/objects/PDFObject' ; class PDFNumber extends PDFObject { static of = ( value ) => new PDFNumber ( value ) ; private readonly numberValue : number ; private readonly stringValue : string ; private constructor ( value ) { super ( ) ; this . numberValue = value ; this . stringValue = numberToString ( value ) ; } asNumber ( ) { return this . numberValue ; } deprecated value ( ) { return this . numberValue ; } clone ( ) { return PDFNumber . of ( this . numberValue ) ; } toString ( ) { return this . stringValue ; } sizeInBytes ( ) { return this . stringValue . length ; } copyBytesInto ( buffer , offset ) { offset += copyStringIntoBuffer ( this . stringValue , buffer , offset ) ; return this . stringValue . length ; } } export default PDFNumber ;