Last change
on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
489 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 | var anObject = require('../internals/an-object');
|
---|
| 3 | var ordinaryToPrimitive = require('../internals/ordinary-to-primitive');
|
---|
| 4 |
|
---|
| 5 | // `Date.prototype[@@toPrimitive](hint)` method implementation
|
---|
| 6 | // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive
|
---|
| 7 | module.exports = function (hint) {
|
---|
| 8 | anObject(this);
|
---|
| 9 | if (hint === 'string' || hint === 'default') hint = 'string';
|
---|
| 10 | else if (hint !== 'number') throw TypeError('Incorrect hint');
|
---|
| 11 | return ordinaryToPrimitive(this, hint);
|
---|
| 12 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.