main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
533 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var $SyntaxError = require('es-errors/syntax');
|
---|
| 4 | var callBound = require('call-bind/callBound');
|
---|
| 5 |
|
---|
| 6 | var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true);
|
---|
| 7 |
|
---|
| 8 | // https://262.ecma-international.org/9.0/#sec-thissymbolvalue
|
---|
| 9 |
|
---|
| 10 | module.exports = function thisSymbolValue(value) {
|
---|
| 11 | if (!$SymbolValueOf) {
|
---|
| 12 | throw new $SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object');
|
---|
| 13 | }
|
---|
| 14 | if (typeof value === 'symbol') {
|
---|
| 15 | return value;
|
---|
| 16 | }
|
---|
| 17 | return $SymbolValueOf(value);
|
---|
| 18 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.