initial commit
This commit is contained in:
15
node_modules/es6-symbol/.lint
generated
vendored
Normal file
15
node_modules/es6-symbol/.lint
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
@root
|
||||
|
||||
module
|
||||
|
||||
tabs
|
||||
indent 2
|
||||
maxlen 100
|
||||
|
||||
ass
|
||||
nomen
|
||||
plusplus
|
||||
newcap
|
||||
vars
|
||||
|
||||
predef+ Symbol
|
||||
4
node_modules/es6-symbol/.npmignore
generated
vendored
Normal file
4
node_modules/es6-symbol/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.DS_Store
|
||||
/node_modules
|
||||
/npm-debug.log
|
||||
/.lintcache
|
||||
11
node_modules/es6-symbol/.travis.yml
generated
vendored
Normal file
11
node_modules/es6-symbol/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
sudo: false # http://docs.travis-ci.com/user/workers/container-based-infrastructure/
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.12
|
||||
- v4
|
||||
- v5
|
||||
- v6
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- medikoo+es6-symbol@medikoo.com
|
||||
57
node_modules/es6-symbol/CHANGES
generated
vendored
Normal file
57
node_modules/es6-symbol/CHANGES
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
v3.1.1 -- 2017.03.15
|
||||
* Improve documentation
|
||||
* Improve error messages
|
||||
* Update dependencies
|
||||
|
||||
v3.1.0 -- 2016.06.03
|
||||
* Fix internals of symbol detection
|
||||
* Ensure Symbol.prototype[Symbol.toPrimitive] in all cases returns primitive value
|
||||
(fixes Node v6 support)
|
||||
* Create native symbols whenver possible
|
||||
|
||||
v3.0.2 -- 2015.12.12
|
||||
* Fix definition flow, so uneven state of Symbol implementation doesn't crash initialization of
|
||||
polyfill. See #13
|
||||
|
||||
v3.0.1 -- 2015.10.22
|
||||
* Workaround for IE11 bug (reported in #12)
|
||||
|
||||
v3.0.0 -- 2015.10.02
|
||||
* Reuse native symbols (e.g. iterator, toStringTag etc.) in a polyfill if they're available
|
||||
Otherwise polyfill symbols may not be recognized by other functions
|
||||
* Improve documentation
|
||||
|
||||
v2.0.1 -- 2015.01.28
|
||||
* Fix Symbol.prototype[Symbol.isPrimitive] implementation
|
||||
* Improve validation within Symbol.prototype.toString and
|
||||
Symbol.prototype.valueOf
|
||||
|
||||
v2.0.0 -- 2015.01.28
|
||||
* Update up to changes in specification:
|
||||
* Implement `for` and `keyFor`
|
||||
* Remove `Symbol.create` and `Symbol.isRegExp`
|
||||
* Add `Symbol.match`, `Symbol.replace`, `Symbol.search`, `Symbol.species` and
|
||||
`Symbol.split`
|
||||
* Rename `validSymbol` to `validateSymbol`
|
||||
* Improve documentation
|
||||
* Remove dead test modules
|
||||
|
||||
v1.0.0 -- 2015.01.26
|
||||
* Fix enumerability for symbol properties set normally (e.g. obj[symbol] = value)
|
||||
* Introduce initialization via hidden constructor
|
||||
* Fix isSymbol handling of polyfill values when native Symbol is present
|
||||
* Fix spelling of LICENSE
|
||||
* Configure lint scripts
|
||||
|
||||
v0.1.1 -- 2014.10.07
|
||||
* Fix isImplemented, so it returns true in case of polyfill
|
||||
* Improve documentations
|
||||
|
||||
v0.1.0 -- 2014.04.28
|
||||
* Assure strictly npm dependencies
|
||||
* Update to use latest versions of dependencies
|
||||
* Fix implementation detection so it doesn't crash on `String(symbol)`
|
||||
* throw on `new Symbol()` (as decided by TC39)
|
||||
|
||||
v0.0.0 -- 2013.11.15
|
||||
* Initial (dev) version
|
||||
19
node_modules/es6-symbol/LICENSE
generated
vendored
Normal file
19
node_modules/es6-symbol/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
71
node_modules/es6-symbol/README.md
generated
vendored
Normal file
71
node_modules/es6-symbol/README.md
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
# es6-symbol
|
||||
## ECMAScript 6 Symbol polyfill
|
||||
|
||||
For more information about symbols see following links
|
||||
- [Symbols in ECMAScript 6 by Axel Rauschmayer](http://www.2ality.com/2014/12/es6-symbols.html)
|
||||
- [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)
|
||||
- [Specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-constructor)
|
||||
|
||||
### Limitations
|
||||
|
||||
Underneath it uses real string property names which can easily be retrieved, however accidental collision with other property names is unlikely.
|
||||
|
||||
### Usage
|
||||
|
||||
If you'd like to use native version when it exists and fallback to [ponyfill](https://ponyfill.com) if it doesn't, use *es6-symbol* as following:
|
||||
|
||||
```javascript
|
||||
var Symbol = require('es6-symbol');
|
||||
```
|
||||
|
||||
If you want to make sure your environment implements `Symbol` globally, do:
|
||||
|
||||
```javascript
|
||||
require('es6-symbol/implement');
|
||||
```
|
||||
|
||||
If you strictly want to use polyfill even if native `Symbol` exists (hard to find a good reason for that), do:
|
||||
|
||||
```javascript
|
||||
var Symbol = require('es6-symbol/polyfill');
|
||||
```
|
||||
|
||||
#### API
|
||||
|
||||
Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-objects). Still if you want quick look, follow examples:
|
||||
|
||||
```javascript
|
||||
var Symbol = require('es6-symbol');
|
||||
|
||||
var symbol = Symbol('My custom symbol');
|
||||
var x = {};
|
||||
|
||||
x[symbol] = 'foo';
|
||||
console.log(x[symbol]); 'foo'
|
||||
|
||||
// Detect iterable:
|
||||
var iterator, result;
|
||||
if (possiblyIterable[Symbol.iterator]) {
|
||||
iterator = possiblyIterable[Symbol.iterator]();
|
||||
result = iterator.next();
|
||||
while(!result.done) {
|
||||
console.log(result.value);
|
||||
result = iterator.next();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Installation
|
||||
#### NPM
|
||||
|
||||
In your project path:
|
||||
|
||||
$ npm install es6-symbol
|
||||
|
||||
##### Browser
|
||||
|
||||
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)
|
||||
|
||||
## Tests [](https://travis-ci.org/medikoo/es6-symbol)
|
||||
|
||||
$ npm test
|
||||
7
node_modules/es6-symbol/implement.js
generated
vendored
Normal file
7
node_modules/es6-symbol/implement.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
if (!require('./is-implemented')()) {
|
||||
Object.defineProperty(require('es5-ext/global'), 'Symbol',
|
||||
{ value: require('./polyfill'), configurable: true, enumerable: false,
|
||||
writable: true });
|
||||
}
|
||||
3
node_modules/es6-symbol/index.js
generated
vendored
Normal file
3
node_modules/es6-symbol/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./is-implemented')() ? Symbol : require('./polyfill');
|
||||
17
node_modules/es6-symbol/is-implemented.js
generated
vendored
Normal file
17
node_modules/es6-symbol/is-implemented.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var validTypes = { object: true, symbol: true };
|
||||
|
||||
module.exports = function () {
|
||||
var symbol;
|
||||
if (typeof Symbol !== 'function') return false;
|
||||
symbol = Symbol('test symbol');
|
||||
try { String(symbol); } catch (e) { return false; }
|
||||
|
||||
// Return 'true' also for polyfills
|
||||
if (!validTypes[typeof Symbol.iterator]) return false;
|
||||
if (!validTypes[typeof Symbol.toPrimitive]) return false;
|
||||
if (!validTypes[typeof Symbol.toStringTag]) return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
5
node_modules/es6-symbol/is-native-implemented.js
generated
vendored
Normal file
5
node_modules/es6-symbol/is-native-implemented.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// Exports true if environment provides native `Symbol` implementation
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
|
||||
9
node_modules/es6-symbol/is-symbol.js
generated
vendored
Normal file
9
node_modules/es6-symbol/is-symbol.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (x) {
|
||||
if (!x) return false;
|
||||
if (typeof x === 'symbol') return true;
|
||||
if (!x.constructor) return false;
|
||||
if (x.constructor.name !== 'Symbol') return false;
|
||||
return (x[x.constructor.toStringTag] === 'Symbol');
|
||||
};
|
||||
71
node_modules/es6-symbol/package.json
generated
vendored
Normal file
71
node_modules/es6-symbol/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"_from": "es6-symbol@^3.1.1",
|
||||
"_id": "es6-symbol@3.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=",
|
||||
"_location": "/es6-symbol",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "es6-symbol@^3.1.1",
|
||||
"name": "es6-symbol",
|
||||
"escapedName": "es6-symbol",
|
||||
"rawSpec": "^3.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/es5-ext",
|
||||
"/es6-iterator",
|
||||
"/es6-weak-map",
|
||||
"/sver-compat"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz",
|
||||
"_shasum": "bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77",
|
||||
"_spec": "es6-symbol@^3.1.1",
|
||||
"_where": "D:\\Air66 Files\\dev_sites\\www.airurl.dev.cc\\user\\plugins\\air66Theme\\node_modules\\sver-compat",
|
||||
"author": {
|
||||
"name": "Mariusz Nowak",
|
||||
"email": "medyk@medikoo.com",
|
||||
"url": "http://www.medikoo.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/medikoo/es6-symbol/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"d": "1",
|
||||
"es5-ext": "~0.10.14"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "ECMAScript 6 Symbol polyfill",
|
||||
"devDependencies": {
|
||||
"tad": "~0.2.7",
|
||||
"xlint": "~0.2.2",
|
||||
"xlint-jslint-medikoo": "~0.1.4"
|
||||
},
|
||||
"homepage": "https://github.com/medikoo/es6-symbol#readme",
|
||||
"keywords": [
|
||||
"symbol",
|
||||
"private",
|
||||
"property",
|
||||
"es6",
|
||||
"ecmascript",
|
||||
"harmony",
|
||||
"ponyfill",
|
||||
"polyfill"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "es6-symbol",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/medikoo/es6-symbol.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream",
|
||||
"lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch",
|
||||
"test": "node ./node_modules/tad/bin/tad"
|
||||
},
|
||||
"version": "3.1.1"
|
||||
}
|
||||
118
node_modules/es6-symbol/polyfill.js
generated
vendored
Normal file
118
node_modules/es6-symbol/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
// ES2015 Symbol polyfill for environments that do not (or partially) support it
|
||||
|
||||
'use strict';
|
||||
|
||||
var d = require('d')
|
||||
, validateSymbol = require('./validate-symbol')
|
||||
|
||||
, create = Object.create, defineProperties = Object.defineProperties
|
||||
, defineProperty = Object.defineProperty, objPrototype = Object.prototype
|
||||
, NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null)
|
||||
, isNativeSafe;
|
||||
|
||||
if (typeof Symbol === 'function') {
|
||||
NativeSymbol = Symbol;
|
||||
try {
|
||||
String(NativeSymbol());
|
||||
isNativeSafe = true;
|
||||
} catch (ignore) {}
|
||||
}
|
||||
|
||||
var generateName = (function () {
|
||||
var created = create(null);
|
||||
return function (desc) {
|
||||
var postfix = 0, name, ie11BugWorkaround;
|
||||
while (created[desc + (postfix || '')]) ++postfix;
|
||||
desc += (postfix || '');
|
||||
created[desc] = true;
|
||||
name = '@@' + desc;
|
||||
defineProperty(objPrototype, name, d.gs(null, function (value) {
|
||||
// For IE11 issue see:
|
||||
// https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
|
||||
// ie11-broken-getters-on-dom-objects
|
||||
// https://github.com/medikoo/es6-symbol/issues/12
|
||||
if (ie11BugWorkaround) return;
|
||||
ie11BugWorkaround = true;
|
||||
defineProperty(this, name, d(value));
|
||||
ie11BugWorkaround = false;
|
||||
}));
|
||||
return name;
|
||||
};
|
||||
}());
|
||||
|
||||
// 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) {
|
||||
if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
|
||||
return SymbolPolyfill(description);
|
||||
};
|
||||
|
||||
// Exposed `Symbol` constructor
|
||||
// (returns instances of HiddenSymbol)
|
||||
module.exports = SymbolPolyfill = function Symbol(description) {
|
||||
var symbol;
|
||||
if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
|
||||
if (isNativeSafe) return NativeSymbol(description);
|
||||
symbol = create(HiddenSymbol.prototype);
|
||||
description = (description === undefined ? '' : String(description));
|
||||
return defineProperties(symbol, {
|
||||
__description__: d('', description),
|
||||
__name__: d('', generateName(description))
|
||||
});
|
||||
};
|
||||
defineProperties(SymbolPolyfill, {
|
||||
for: d(function (key) {
|
||||
if (globalSymbols[key]) return globalSymbols[key];
|
||||
return (globalSymbols[key] = SymbolPolyfill(String(key)));
|
||||
}),
|
||||
keyFor: d(function (s) {
|
||||
var key;
|
||||
validateSymbol(s);
|
||||
for (key in globalSymbols) if (globalSymbols[key] === s) return key;
|
||||
}),
|
||||
|
||||
// To ensure proper interoperability with other native functions (e.g. Array.from)
|
||||
// fallback to eventual native implementation of given symbol
|
||||
hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
|
||||
isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
|
||||
SymbolPolyfill('isConcatSpreadable')),
|
||||
iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
|
||||
match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
|
||||
replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
|
||||
search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
|
||||
species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
|
||||
split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
|
||||
toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
|
||||
toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
|
||||
unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
|
||||
});
|
||||
|
||||
// Internal tweaks for real symbol producer
|
||||
defineProperties(HiddenSymbol.prototype, {
|
||||
constructor: d(SymbolPolyfill),
|
||||
toString: d('', function () { return this.__name__; })
|
||||
});
|
||||
|
||||
// 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, {
|
||||
toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
|
||||
valueOf: d(function () { return validateSymbol(this); })
|
||||
});
|
||||
defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () {
|
||||
var symbol = validateSymbol(this);
|
||||
if (typeof symbol === 'symbol') return symbol;
|
||||
return symbol.toString();
|
||||
}));
|
||||
defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));
|
||||
|
||||
// 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]));
|
||||
3
node_modules/es6-symbol/test/implement.js
generated
vendored
Normal file
3
node_modules/es6-symbol/test/implement.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) { a(typeof Symbol, 'function'); };
|
||||
12
node_modules/es6-symbol/test/index.js
generated
vendored
Normal file
12
node_modules/es6-symbol/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var d = require('d')
|
||||
|
||||
, defineProperty = Object.defineProperty;
|
||||
|
||||
module.exports = function (T, a) {
|
||||
var symbol = T('test'), x = {};
|
||||
defineProperty(x, symbol, d('foo'));
|
||||
a(x.test, undefined, "Name");
|
||||
a(x[symbol], 'foo', "Get");
|
||||
};
|
||||
14
node_modules/es6-symbol/test/is-implemented.js
generated
vendored
Normal file
14
node_modules/es6-symbol/test/is-implemented.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var global = require('es5-ext/global')
|
||||
, polyfill = require('../polyfill');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var cache;
|
||||
a(typeof t(), 'boolean');
|
||||
cache = global.Symbol;
|
||||
global.Symbol = polyfill;
|
||||
a(t(), true);
|
||||
if (cache === undefined) delete global.Symbol;
|
||||
else global.Symbol = cache;
|
||||
};
|
||||
3
node_modules/es6-symbol/test/is-native-implemented.js
generated
vendored
Normal file
3
node_modules/es6-symbol/test/is-native-implemented.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) { a(typeof t, 'boolean'); };
|
||||
16
node_modules/es6-symbol/test/is-symbol.js
generated
vendored
Normal file
16
node_modules/es6-symbol/test/is-symbol.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var SymbolPoly = require('../polyfill');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(undefined), false, "Undefined");
|
||||
a(t(null), false, "Null");
|
||||
a(t(true), false, "Primitive");
|
||||
a(t('raz'), false, "String");
|
||||
a(t({}), false, "Object");
|
||||
a(t([]), false, "Array");
|
||||
if (typeof Symbol !== 'undefined') {
|
||||
a(t(Symbol()), true, "Native");
|
||||
}
|
||||
a(t(SymbolPoly()), true, "Polyfill");
|
||||
};
|
||||
29
node_modules/es6-symbol/test/polyfill.js
generated
vendored
Normal file
29
node_modules/es6-symbol/test/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var d = require('d')
|
||||
, isSymbol = require('../is-symbol')
|
||||
|
||||
, defineProperty = Object.defineProperty;
|
||||
|
||||
module.exports = function (T, a) {
|
||||
var symbol = T('test'), x = {};
|
||||
defineProperty(x, symbol, d('foo'));
|
||||
a(x.test, undefined, "Name");
|
||||
a(x[symbol], 'foo', "Get");
|
||||
a(x instanceof T, false);
|
||||
|
||||
a(isSymbol(symbol), true, "Symbol");
|
||||
a(isSymbol(T.iterator), true, "iterator");
|
||||
a(isSymbol(T.toStringTag), true, "toStringTag");
|
||||
|
||||
x = {};
|
||||
x[symbol] = 'foo';
|
||||
if (typeof symbol !== 'symbol') {
|
||||
a.deep(Object.getOwnPropertyDescriptor(x, symbol), { configurable: true, enumerable: false,
|
||||
value: 'foo', writable: true });
|
||||
}
|
||||
symbol = T.for('marko');
|
||||
a(isSymbol(symbol), true);
|
||||
a(T.for('marko'), symbol);
|
||||
a(T.keyFor(symbol), 'marko');
|
||||
};
|
||||
19
node_modules/es6-symbol/test/validate-symbol.js
generated
vendored
Normal file
19
node_modules/es6-symbol/test/validate-symbol.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var SymbolPoly = require('../polyfill');
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var symbol;
|
||||
a.throws(function () { t(undefined); }, TypeError, "Undefined");
|
||||
a.throws(function () { t(null); }, TypeError, "Null");
|
||||
a.throws(function () { t(true); }, TypeError, "Primitive");
|
||||
a.throws(function () { t('raz'); }, TypeError, "String");
|
||||
a.throws(function () { t({}); }, TypeError, "Object");
|
||||
a.throws(function () { t([]); }, TypeError, "Array");
|
||||
if (typeof Symbol !== 'undefined') {
|
||||
symbol = Symbol();
|
||||
a(t(symbol), symbol, "Native");
|
||||
}
|
||||
symbol = SymbolPoly();
|
||||
a(t(symbol), symbol, "Polyfill");
|
||||
};
|
||||
8
node_modules/es6-symbol/validate-symbol.js
generated
vendored
Normal file
8
node_modules/es6-symbol/validate-symbol.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var isSymbol = require('./is-symbol');
|
||||
|
||||
module.exports = function (value) {
|
||||
if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
|
||||
return value;
|
||||
};
|
||||
Reference in New Issue
Block a user