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 0.0.0 to 0.1.0

CHANGES

6

is-implemented.js

@@ -6,4 +6,6 @@ 'use strict';

if (typeof Symbol !== 'function') return false;
symbol = new Symbol('test symbol');
if (String(symbol) !== 'Symbol (test symbol)') return false;
symbol = Symbol('test symbol');
try {
if (String(symbol) !== 'Symbol (test symbol)') return false;
} catch (e) { return false; }
if (typeof Symbol.iterator === 'symbol') return true;

@@ -10,0 +12,0 @@

{
"name": "es6-symbol",
"version": "0.0.0",
"version": "0.1.0",
"description": "ECMAScript6 Symbol polyfill",

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

},
"scripts": {
"test": "node ./node_modules/tad/bin/tad"
},
"dependencies": {
"d": "git://github.com/medikoo/d.git",
"es5-ext": "git://github.com/medikoo/es5-ext.git"
"d": "~0.1.1",
"es5-ext": "~0.10.2"
},
"devDependencies": {
"tad": "~0.1.20"
"tad": "0.2.x"
},
"scripts": {
"test": "node ./node_modules/tad/bin/tad"
},
"license": "MIT"
}
'use strict';
var d = require('d/d')
var d = require('d')
, defineProperties = Object.defineProperties
, create = Object.create, defineProperties = Object.defineProperties
, generateName, Symbol;
generateName = (function () {
var created = Object.create(null);
var created = create(null);
return function (desc) {

@@ -20,5 +20,9 @@ var postfix = 0;

module.exports = Symbol = function (description) {
if (!(this instanceof Symbol)) return new Symbol(description);
var symbol;
if (this instanceof Symbol) {
throw new TypeError('TypeError: Symbol is not a constructor');
}
symbol = create(Symbol.prototype);
description = (description === undefined ? '' : String(description));
return defineProperties(this, {
return defineProperties(symbol, {
__description__: d('', description),

@@ -30,10 +34,10 @@ __name__: d('', generateName(description))

Object.defineProperties(Symbol, {
create: d('', new Symbol('create')),
hasInstance: d('', new Symbol('hasInstance')),
isConcatSpreadable: d('', new Symbol('isConcatSpreadable')),
isRegExp: d('', new Symbol('isRegExp')),
iterator: d('', new Symbol('iterator')),
toPrimitive: d('', new Symbol('toPrimitive')),
toStringTag: d('', new Symbol('toStringTag')),
unscopables: d('', new Symbol('unscopables'))
create: d('', Symbol('create')),
hasInstance: d('', Symbol('hasInstance')),
isConcatSpreadable: d('', Symbol('isConcatSpreadable')),
isRegExp: d('', Symbol('isRegExp')),
iterator: d('', Symbol('iterator')),
toPrimitive: d('', Symbol('toPrimitive')),
toStringTag: d('', Symbol('toStringTag')),
unscopables: d('', Symbol('unscopables'))
});

@@ -47,5 +51,2 @@

});
Object.defineProperty(Symbol.prototype, 'originalToString', d(function () {
return 'Symbol (' + this.__description__ + ')';
}));
Object.defineProperty(Symbol.prototype, Symbol.toPrimitive, d('',

@@ -52,0 +53,0 @@ function (hint) {

@@ -7,3 +7,3 @@ # es6-symbol

- Underneath it uses real string property names which can easily be retrieved (however accidental collision with other property names is unlikely)
- As it needs custom `toString` behavior to work properly. Original `Symbol.prototoype.toString` couldn't be implemented as specified, still it's accessible as `Symbol.prototoype.origigalToString`
- As it needs custom `toString` behavior to work properly. Original `Symbol.prototoype.toString` couldn't be implemented as specified, still it's accessible as `Symbol.prototoype.properToString`

@@ -24,3 +24,3 @@ ### Usage

If you strictly want to use polyfill even if native `Symbol` exists (hard to find good reason for that), do:
If you strictly want to use polyfill even if native `Symbol` exists (hard to find a good reason for that), do:

@@ -38,3 +38,3 @@ ```javascript

var symbol = new Symbol('My custom symbol');
var symbol = Symbol('My custom symbol');
var x = {};

@@ -53,3 +53,3 @@

result = iterator.next();
}
}
}

@@ -56,0 +56,0 @@ ```

'use strict';
var d = require('d/d')
var d = require('d')

@@ -8,3 +8,3 @@ , defineProperty = Object.defineProperty;

module.exports = function (T, a) {
var symbol = new T('test'), x = {};
var symbol = T('test'), x = {};
defineProperty(x, symbol, d('foo'));

@@ -11,0 +11,0 @@ a(x.test, undefined, "Name");

@@ -13,5 +13,5 @@ 'use strict';

if (typeof Symbol !== 'undefined') {
a(t(new Symbol()), true, "Native");
a(t(Symbol()), true, "Native");
}
a(t(new SymbolPoly()), true, "Polyfill");
a(t(SymbolPoly()), true, "Polyfill");
};
'use strict';
var d = require('d/d')
var d = require('d')
, isSymbol = require('../is-symbol')

@@ -9,3 +9,3 @@

module.exports = function (T, a) {
var symbol = new T('test'), x = {};
var symbol = T('test'), x = {};
defineProperty(x, symbol, d('foo'));

@@ -12,0 +12,0 @@ a(x.test, undefined, "Name");

@@ -14,7 +14,7 @@ 'use strict';

if (typeof Symbol !== 'undefined') {
symbol = new Symbol();
symbol = Symbol();
a(t(symbol), symbol, "Native");
}
symbol = new SymbolPoly();
symbol = SymbolPoly();
a(t(symbol), symbol, "Polyfill");
};

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