pointfreeco / swift-custom-dump

A collection of tools for debugging, diffing, and testing your application's data structures.
MIT License
800 stars 89 forks source link

Add Decimal conformance #9

Closed konomae closed 3 years ago

konomae commented 3 years ago
customDump(NSDecimalNumber(string: "1.23"))
customDump(Decimal(string: "1.23"))

Before:

1.23
NSDecimal(
  _mantissa: (
    123,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  )
)

After:

1.23
1.23

Note: Swift.dump

dump(NSDecimalNumber(string: "1.23"))
dump(Decimal(string: "1.23"))
- 1.23 #0
  - super: NSNumber
    - super: NSValue
      - super: NSObject
▿ Optional(1.23)
  ▿ some: 1.23
    ▿ _mantissa: (8 elements)
      - .0: 123
      - .1: 0
      - .2: 0
      - .3: 0
      - .4: 0
      - .5: 0
      - .6: 0
      - .7: 0