1
|
'use strict';
|
2
|
|
3
|
var callBound = require('../helpers/callBound');
|
4
|
|
5
|
var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true);
|
6
|
|
7
|
var Type = require('./Type');
|
8
|
|
9
|
// https://ecma-international.org/ecma-262/9.0/#sec-thissymbolvalue
|
10
|
|
11
|
module.exports = function thisSymbolValue(value) {
|
12
|
if (!$SymbolValueOf) {
|
13
|
throw new SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object');
|
14
|
}
|
15
|
if (Type(value) === 'Symbol') {
|
16
|
return value;
|
17
|
}
|
18
|
return $SymbolValueOf(value);
|
19
|
};
|