Socket
Socket
Sign inDemoInstall

es6-symbol

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-symbol - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

4

package.json
{
"name": "es6-symbol",
"version": "3.0.1",
"version": "3.0.2",
"description": "ECMAScript 6 Symbol polyfill",

@@ -22,3 +22,3 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",

"d": "~0.1.1",
"es5-ext": "~0.10.8"
"es5-ext": "~0.10.10"
},

@@ -25,0 +25,0 @@ "devDependencies": {

@@ -0,1 +1,3 @@

// ES2015 Symbol polyfill for environments that do not support it (or partially support it_
'use strict';

@@ -34,2 +36,4 @@

// Internal constructor (not one exposed) for creating Symbol instances.
// This one is used to ensure that `someSymbol instanceof Symbol` always return false
HiddenSymbol = function Symbol(description) {

@@ -39,2 +43,5 @@ if (this instanceof HiddenSymbol) throw new TypeError('TypeError: Symbol is not a constructor');

};
// Exposed `Symbol` constructor
// (returns instances of HiddenSymbol)
module.exports = SymbolPolyfill = function Symbol(description) {

@@ -60,2 +67,5 @@ var symbol;

}),
// If there's native implementation of given symbol, let's fallback to it
// to ensure proper interoperability with other native functions e.g. Array.from
hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),

@@ -74,2 +84,4 @@ isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||

});
// Internal tweaks for real symbol producer
defineProperties(HiddenSymbol.prototype, {

@@ -80,2 +92,4 @@ constructor: d(SymbolPolyfill),

// Proper implementation of methods exposed on Symbol.prototype
// They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
defineProperties(SymbolPolyfill.prototype, {

@@ -89,5 +103,11 @@ toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),

// Proper implementaton of toPrimitive and toStringTag for returned symbol instances
defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
// Note: It's important to define `toPrimitive` as last one, as some implementations
// implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
// And that may invoke error in definition flow:
// See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc