mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
Add new function number(n)
This commit is contained in:
parent
8b4f1536b5
commit
d6b7fe88e4
@ -129,7 +129,12 @@ class PDFDocument extends stream.Readable
|
||||
@_offsets.push null # placeholder for this object's offset once it is finalized
|
||||
@_waiting++
|
||||
return ref
|
||||
|
||||
|
||||
number: (n) ->
|
||||
if n > -1e21 and n < 1e21
|
||||
return Math.round(n * 1e6) / 1e6
|
||||
throw new Error "unsupported number: #{n}"
|
||||
|
||||
_read: ->
|
||||
# do nothing, but this method is required by node
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user