2020-08-26 01:57:08 +02:00
|
|
|
'use strict';
|
|
|
|
|
2021-02-26 04:58:33 +01:00
|
|
|
var callBound = require('call-bind/callBound');
|
2020-08-26 01:57:08 +02:00
|
|
|
|
|
|
|
var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true);
|
|
|
|
|
|
|
|
var Type = require('./Type');
|
|
|
|
|
2022-11-10 11:43:16 +01:00
|
|
|
// https://262.ecma-international.org/9.0/#sec-thissymbolvalue
|
2020-08-26 01:57:08 +02:00
|
|
|
|
|
|
|
module.exports = function thisSymbolValue(value) {
|
|
|
|
if (!$SymbolValueOf) {
|
|
|
|
throw new SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object');
|
|
|
|
}
|
|
|
|
if (Type(value) === 'Symbol') {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
return $SymbolValueOf(value);
|
|
|
|
};
|