Symbol 断言
小于 1 分钟
Symbol
断言
模块
类型
interface SymbolConstructor {
isRegisteredSymbol(value: symbol): boolean;
isWellKnownSymbol(value: symbol): boolean;
}
入口点
core-js/proposals/symbol-predicates-v2
core-js(-pure)/full/symbol/is-registered-symbol
core-js(-pure)/full/symbol/is-well-known-symbol
示例
Symbol.isRegisteredSymbol(Symbol.for("key")); // => true
Symbol.isRegisteredSymbol(Symbol("key")); // => false
Symbol.isWellKnownSymbol(Symbol.iterator); // => true
Symbol.isWellKnownSymbol(Symbol("key")); // => false