date-to-primitive.js 327 B

123456789
  1. 'use strict';
  2. var anObject = require('../internals/an-object');
  3. var toPrimitive = require('../internals/to-primitive');
  4. module.exports = function (hint) {
  5. if (hint !== 'string' && hint !== 'number' && hint !== 'default') {
  6. throw TypeError('Incorrect hint');
  7. } return toPrimitive(anObject(this), hint !== 'number');
  8. };