Version 1
[yaffs-website] / node_modules / core-js / library / modules / es6.date.to-json.js
1 'use strict';
2 var $export     = require('./_export')
3   , toObject    = require('./_to-object')
4   , toPrimitive = require('./_to-primitive');
5
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;
8 }), 'Date', {
9   toJSON: function toJSON(key){
10     var O  = toObject(this)
11       , pv = toPrimitive(O);
12     return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
13   }
14 });