to-property-key.js 319 B

123456789
  1. var toPrimitive = require('../internals/to-primitive');
  2. var isSymbol = require('../internals/is-symbol');
  3. // `ToPropertyKey` abstract operation
  4. // https://tc39.es/ecma262/#sec-topropertykey
  5. module.exports = function (argument) {
  6. var key = toPrimitive(argument, 'string');
  7. return isSymbol(key) ? key : key + '';
  8. };