main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
510 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var callBound = require('call-bind/callBound');
|
---|
| 4 |
|
---|
| 5 | var $SyntaxError = require('es-errors/syntax');
|
---|
| 6 | var $bigIntValueOf = callBound('BigInt.prototype.valueOf', true);
|
---|
| 7 |
|
---|
| 8 | var Type = require('./Type');
|
---|
| 9 |
|
---|
| 10 | // https://262.ecma-international.org/11.0/#sec-thisbigintvalue
|
---|
| 11 |
|
---|
| 12 | module.exports = function thisBigIntValue(value) {
|
---|
| 13 | var type = Type(value);
|
---|
| 14 | if (type === 'BigInt') {
|
---|
| 15 | return value;
|
---|
| 16 | }
|
---|
| 17 | if (!$bigIntValueOf) {
|
---|
| 18 | throw new $SyntaxError('BigInt is not supported');
|
---|
| 19 | }
|
---|
| 20 | return $bigIntValueOf(value);
|
---|
| 21 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.