to-property-key.js 333 B

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