2020-08-25 23:57:08 +00:00
|
|
|
'use strict';
|
|
|
|
|
2021-02-26 03:58:33 +00:00
|
|
|
var callBound = require('call-bind/callBound');
|
2020-08-25 23:57:08 +00:00
|
|
|
|
|
|
|
var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true);
|
|
|
|
|
|
|
|
var Type = require('./Type');
|
|
|
|
|
2022-11-10 10:43:16 +00:00
|
|
|
// https://262.ecma-international.org/9.0/#sec-thissymbolvalue
|
2020-08-25 23:57:08 +00: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);
|
|
|
|
};
|