Skip to content

Number objects vs. numbers #50

Description

@SuperLlama88888

Platform: Web JS, imported from https://cdn.jsdelivr.net/npm/nbtify@2.0.0/+esm

When reading NBT data, integers and bytes are expressed as Number() objects instead of numbers. These can only be created with the new Number() constructor and have the following drawbacks:

  • new Number(2) === 2 is false
  • typeof new Number(2) is object
  • Console debugging is a bit more awkward as they take up more space.

Is this decision intentional? I know this is true for integers and bytes, but I haven't tested other number types.

Thank you for your time and such a useful library!

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions