2017-10-03 23:00:31 +02:00
|
|
|
// Copyright (C) 2017 Robin Templeton. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
|
|
|
description: BigInt toJSON method
|
|
|
|
esid: sec-serializejsonproperty
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2017-10-03 23:00:31 +02:00
|
|
|
Runtime Semantics: SerializeJSONProperty ( key, holder )
|
|
|
|
|
|
|
|
2. If Type(value) is Object or BigInt, then
|
|
|
|
a. Let toJSON be ? GetGetV(value, "toJSON").
|
|
|
|
b. If IsCallable(toJSON) is true, then
|
|
|
|
i. Set value to ? Call(toJSON, value, « key »).
|
|
|
|
features: [BigInt]
|
|
|
|
---*/
|
|
|
|
|
2018-02-09 18:09:47 +01:00
|
|
|
BigInt.prototype.toJSON = function () { return this.toString(); };
|
2017-10-03 23:00:31 +02:00
|
|
|
assert.sameValue(JSON.stringify(0n), '"0"');
|