Coder Social home page Coder Social logo

es-symbol's Introduction

es-symbol

A spec-compliant as much as it could be, small, and tested ES6 Symbol implementation.

NPM version Build Status Coverage Status Dependency Status

  • No unnecessary dependencies
  • Works in node + browser (IE8--Modern browsers)
  • Uses native Symbol if possible otherwise exports a polyfill

Usage

npm install es-symbol
var Symbol = require('es-symbol')

var sym = Symbol('foo')

var obj = {}
obj[sym] = 'hello'

// The following are true
obj.foo === undefined
obj[sym] === 'hello'

Disclaimer: This depends on ES5. If you need to support legacy browsers consider using an ES5 shim.

More information

Symbol Spec

Symbols in ECMAScript 6

License

MIT

es-symbol's People

Contributors

goatslacker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

es-symbol's Issues

Does this polyfill cause a stack overflow in IE11?

I have an issue (webcomponents/webcomponentsjs#972) filed with the Web Components polyfills that appear to use this module to polyfill Symbol.

The issue is that using the Web Components polyfills to get Web Components working in IE 11 causes a stack overflow error.

Out of stack space / Stack overflow

symbol.js defProp

I found that loading the Symbol polyfill from core-js before the Web Component polyfills got things working as expected.

What appears to be fixing the problem is that a different Symbol polyfill gets loaded first. It creates window.Symbol. Then the feature is detected in @webcomponents/webcomponentsjs/src/symbol.js, so this Symbol polyfill (es-symbol/dist/symbol.js) doesn't get used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.