Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigInt support #96

Closed
dnicolson opened this issue Nov 4, 2019 · 0 comments · Fixed by #138
Closed

BigInt support #96

dnicolson opened this issue Nov 4, 2019 · 0 comments · Fixed by #138

Comments

@dnicolson
Copy link
Contributor

dnicolson commented Nov 4, 2019

The object type BigInt is not recognised and keys are created without values resulting in invalid property lists.

Nested BigInteger.js objects are treated as if they are key/value objects and as a result produce dict elements without values and "Value missing for key inside " plutil lint errors.

The following code:

const bigInt = require('big-integer')
const plist = require('plist')

const obj = {key1: bigInt('ffffffffffffffbf', 16), key2: BigInt(1)}
console.log(obj)
console.log(JSON.stringify(obj.key1))
console.log(plist.build(obj))

Produces the following output:

{ key1: Integer { value: 18446744073709551551n }, key2: 1n }
"18446744073709551551"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>key1</key>
    <dict>
      <key>value</key>
    </dict>
    <key>key2</key>
  </dict>
</plist>
@dnicolson dnicolson changed the title "Value missing for key inside <dict>" lint error when using BigInteger.js BigInt support Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant