vue hello world项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

59 lines
2.5 KiB

// `Symbol.prototype.description` getter
// https://tc39.es/ecma262/#sec-symbol.prototype.description
'use strict';
var $ = require('../internals/export');
var DESCRIPTORS = require('../internals/descriptors');
var global = require('../internals/global');
var uncurryThis = require('../internals/function-uncurry-this');
var hasOwn = require('../internals/has-own-property');
var isCallable = require('../internals/is-callable');
var isPrototypeOf = require('../internals/object-is-prototype-of');
var toString = require('../internals/to-string');
var defineProperty = require('../internals/object-define-property').f;
var copyConstructorProperties = require('../internals/copy-constructor-properties');
var NativeSymbol = global.Symbol;
var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
// Safari 12 bug
NativeSymbol().description !== undefined
)) {
var EmptyStringDescriptionStore = {};
// wrap Symbol constructor for correct work with undefined description
var SymbolWrapper = function Symbol() {
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
var result = isPrototypeOf(SymbolPrototype, this)
? new NativeSymbol(description)
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
: description === undefined ? NativeSymbol() : NativeSymbol(description);
if (description === '') EmptyStringDescriptionStore[result] = true;
return result;
};
copyConstructorProperties(SymbolWrapper, NativeSymbol);
SymbolWrapper.prototype = SymbolPrototype;
SymbolPrototype.constructor = SymbolWrapper;
var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
var symbolToString = uncurryThis(SymbolPrototype.toString);
var symbolValueOf = uncurryThis(SymbolPrototype.valueOf);
var regexp = /^Symbol\((.*)\)[^)]+$/;
var replace = uncurryThis(''.replace);
var stringSlice = uncurryThis(''.slice);
defineProperty(SymbolPrototype, 'description', {
configurable: true,
get: function description() {
var symbol = symbolValueOf(this);
var string = symbolToString(symbol);
if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
return desc === '' ? undefined : desc;
}
});
$({ global: true, forced: true }, {
Symbol: SymbolWrapper
});
}