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