wallet-core/node_modules/core-js/modules/es6.date.to-json.js

17 lines
562 B
JavaScript
Raw Normal View History

2017-05-28 00:38:50 +02:00
'use strict';
2017-08-14 05:01:11 +02:00
var $export = require('./_export');
var toObject = require('./_to-object');
var toPrimitive = require('./_to-primitive');
2017-05-28 00:38:50 +02:00
2017-08-14 05:01:11 +02:00
$export($export.P + $export.F * require('./_fails')(function () {
return new Date(NaN).toJSON() !== null
|| Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1;
2017-05-28 00:38:50 +02:00
}), 'Date', {
2017-08-14 05:01:11 +02:00
// eslint-disable-next-line no-unused-vars
toJSON: function toJSON(key) {
var O = toObject(this);
var pv = toPrimitive(O);
2017-05-28 00:38:50 +02:00
return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
}
2017-08-14 05:01:11 +02:00
});