Skip to content

Commit 7271d59

Browse files
authored
Merge pull request #138 from dnicolson/add-bigint-support
Add BigInt support
2 parents 89a74fc + 80d65bc commit 7271d59

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

lib/build.js

+3
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ function walk_obj(next, next_child) {
117117
tag_type = (next % 1 === 0) ? 'integer' : 'real';
118118
next_child.ele(tag_type).txt(next.toString());
119119

120+
} else if ('BigInt' == name) {
121+
next_child.ele('integer').txt(next);
122+
120123
} else if ('Date' == name) {
121124
next_child.ele('date').txt(ISODateString(new Date(next)));
122125

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
"test": "make test"
3939
},
4040
"engines": {
41-
"node": ">=6"
41+
"node": ">=10.4.0"
4242
}
4343
}

test/build.js

+11
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ describe('plist', function () {
4040
*/}));
4141
});
4242

43+
it('should create a plist XML real from a BigInt', function () {
44+
var xml = build(BigInt('0x1fffffffffffff'));
45+
assert.strictEqual(xml, multiline(function () {/*
46+
<?xml version="1.0" encoding="UTF-8"?>
47+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
48+
<plist version="1.0">
49+
<integer>9007199254740991</integer>
50+
</plist>
51+
*/}));
52+
});
53+
4354
it('should create a plist XML date from a Date', function () {
4455
var xml = build(new Date('2010-02-08T21:41:23Z'));
4556
assert.strictEqual(xml, multiline(function () {/*

0 commit comments

Comments
 (0)