web 3d图形渲染器
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.

23 lines
556 B

  1. "use strict";
  2. var d = require("d")
  3. , validateSymbol = require("../../../validate-symbol");
  4. var registry = Object.create(null);
  5. module.exports = function (SymbolPolyfill) {
  6. return Object.defineProperties(SymbolPolyfill, {
  7. for: d(function (key) {
  8. if (registry[key]) return registry[key];
  9. return (registry[key] = SymbolPolyfill(String(key)));
  10. }),
  11. keyFor: d(function (symbol) {
  12. var key;
  13. validateSymbol(symbol);
  14. for (key in registry) {
  15. if (registry[key] === symbol) return key;
  16. }
  17. return undefined;
  18. })
  19. });
  20. };