ljharb / es-abstract

ECMAScript spec abstract operations.
MIT License
114 stars 30 forks source link

[Fix] `helpers/getSymbolDescription`: use the global Symbol registry when available #92

Closed ExE-Boss closed 4 years ago

ExE-Boss commented 4 years ago

This changes getSymbolDescription to be a call bound %Symbol.prototype.description% in ES2019+ environments, and adds a fallback to use Symbol.keyFor to get the [[Description]] internal slot value of global symbols in pre‑ES2019 environments that support symbols.

codecov[bot] commented 4 years ago

Codecov Report

Merging #92 into master will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #92   +/-   ##
=======================================
  Coverage   90.97%   90.98%           
=======================================
  Files         647      647           
  Lines        9041     9047    +6     
  Branches     2125     2127    +2     
=======================================
+ Hits         8225     8231    +6     
  Misses        816      816           
Impacted Files Coverage Δ
helpers/getSymbolDescription.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2ab5e6d...9e1c00d. Read the comment docs.

ljharb commented 4 years ago

nvm, answered my own question. looks like node v0.12, v4, v5, io.js all can not infer names but have Symbol.for.