2 var $export = require('./_export')
3 , toObject = require('./_to-object')
4 , toPrimitive = require('./_to-primitive');
6 $export($export.P + $export.F * require('./_fails')(function(){
7 return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({toISOString: function(){ return 1; }}) !== 1;
9 toJSON: function toJSON(key){
10 var O = toObject(this)
11 , pv = toPrimitive(O);
12 return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();