mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
16
web/node_modules/es6-symbol/.editorconfig
generated
vendored
Executable file
16
web/node_modules/es6-symbol/.editorconfig
generated
vendored
Executable file
|
@ -0,0 +1,16 @@
|
|||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = false
|
1
web/node_modules/es6-symbol/.github/FUNDING.yml
generated
vendored
Normal file
1
web/node_modules/es6-symbol/.github/FUNDING.yml
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
tidelift: "npm/es6-symbol"
|
1
web/node_modules/es6-symbol/.testignore
generated
vendored
Normal file
1
web/node_modules/es6-symbol/.testignore
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/lib/private
|
16
web/node_modules/es6-symbol/CHANGELOG.md
generated
vendored
Normal file
16
web/node_modules/es6-symbol/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [3.1.3](https://github.com/medikoo/es6-symbol/compare/v3.1.2...v3.1.3) (2019-10-29)
|
||||
|
||||
### [3.1.2](https://github.com/medikoo/es6-symbol/compare/v3.1.1...v3.1.2) (2019-09-04)
|
||||
|
||||
- Access `Symbol` from a global object. Makes implementation more bulletproof, as it's safe against shadowing the `Symbol` variable e.g. in script scope, or as it's practiced by some bundlers as Webpack (thanks [@cyborgx37](https://github.com/medikoo/es6-symbol/pull/30))
|
||||
- Switch license from MIT to ISC
|
||||
- Switch linter to ESLint
|
||||
- Configure Prettier
|
||||
|
||||
## Changelog for previous versions
|
||||
|
||||
See `CHANGES` file
|
61
web/node_modules/es6-symbol/CHANGES
generated
vendored
Normal file
61
web/node_modules/es6-symbol/CHANGES
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
For recent changelog see CHANGELOG.md
|
||||
|
||||
-----
|
||||
|
||||
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
|
15
web/node_modules/es6-symbol/LICENSE
generated
vendored
Normal file
15
web/node_modules/es6-symbol/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
ISC License
|
||||
|
||||
Copyright (c) 2013-2019, Mariusz Nowak, @medikoo, medikoo.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
104
web/node_modules/es6-symbol/README.md
generated
vendored
Normal file
104
web/node_modules/es6-symbol/README.md
generated
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
[![Build status][nix-build-image]][nix-build-url]
|
||||
[![Windows status][win-build-image]][win-build-url]
|
||||
![Transpilation status][transpilation-image]
|
||||
[![npm version][npm-image]][npm-url]
|
||||
|
||||
# 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](https://tc39.github.io/ecma262/#sec-symbol-objects)
|
||||
|
||||
### 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](https://tc39.github.io/ecma262/#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
|
||||
|
||||
$ npm test
|
||||
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-es6-symbol?utm_source=npm-es6-symbol&utm_medium=referral&utm_campaign=readme">Get professional support for d with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/es6-symbol/branches/master/shields_badge.svg
|
||||
[nix-build-url]: https://semaphoreci.com/medikoo-org/es6-symbol
|
||||
[win-build-image]: https://ci.appveyor.com/api/projects/status/1s743lt3el278anj?svg=true
|
||||
[win-build-url]: https://ci.appveyor.com/project/medikoo/es6-symbol
|
||||
[transpilation-image]: https://img.shields.io/badge/transpilation-free-brightgreen.svg
|
||||
[npm-image]: https://img.shields.io/npm/v/es6-symbol.svg
|
||||
[npm-url]: https://www.npmjs.com/package/es6-symbol
|
10
web/node_modules/es6-symbol/implement.js
generated
vendored
Normal file
10
web/node_modules/es6-symbol/implement.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(require("ext/global-this"), "Symbol", {
|
||||
value: require("./polyfill"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
5
web/node_modules/es6-symbol/index.js
generated
vendored
Normal file
5
web/node_modules/es6-symbol/index.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")()
|
||||
? require("ext/global-this").Symbol
|
||||
: require("./polyfill");
|
20
web/node_modules/es6-symbol/is-implemented.js
generated
vendored
Normal file
20
web/node_modules/es6-symbol/is-implemented.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
|
||||
var global = require("ext/global-this")
|
||||
, validTypes = { object: true, symbol: true };
|
||||
|
||||
module.exports = function () {
|
||||
var Symbol = global.Symbol;
|
||||
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;
|
||||
};
|
7
web/node_modules/es6-symbol/is-native-implemented.js
generated
vendored
Normal file
7
web/node_modules/es6-symbol/is-native-implemented.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
// Exports true if environment provides native `Symbol` implementation
|
||||
|
||||
"use strict";
|
||||
|
||||
var Symbol = require("ext/global-this").Symbol;
|
||||
|
||||
module.exports = typeof Symbol === "function" && typeof Symbol() === "symbol";
|
9
web/node_modules/es6-symbol/is-symbol.js
generated
vendored
Normal file
9
web/node_modules/es6-symbol/is-symbol.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = function (value) {
|
||||
if (!value) return false;
|
||||
if (typeof value === "symbol") return true;
|
||||
if (!value.constructor) return false;
|
||||
if (value.constructor.name !== "Symbol") return false;
|
||||
return value[value.constructor.toStringTag] === "Symbol";
|
||||
};
|
29
web/node_modules/es6-symbol/lib/private/generate-name.js
generated
vendored
Normal file
29
web/node_modules/es6-symbol/lib/private/generate-name.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
|
||||
var d = require("d");
|
||||
|
||||
var create = Object.create, defineProperty = Object.defineProperty, objPrototype = Object.prototype;
|
||||
|
||||
var created = create(null);
|
||||
module.exports = 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;
|
||||
};
|
34
web/node_modules/es6-symbol/lib/private/setup/standard-symbols.js
generated
vendored
Normal file
34
web/node_modules/es6-symbol/lib/private/setup/standard-symbols.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
|
||||
var d = require("d")
|
||||
, NativeSymbol = require("ext/global-this").Symbol;
|
||||
|
||||
module.exports = function (SymbolPolyfill) {
|
||||
return Object.defineProperties(SymbolPolyfill, {
|
||||
// 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")
|
||||
)
|
||||
});
|
||||
};
|
23
web/node_modules/es6-symbol/lib/private/setup/symbol-registry.js
generated
vendored
Normal file
23
web/node_modules/es6-symbol/lib/private/setup/symbol-registry.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
|
||||
var d = require("d")
|
||||
, validateSymbol = require("../../../validate-symbol");
|
||||
|
||||
var registry = Object.create(null);
|
||||
|
||||
module.exports = function (SymbolPolyfill) {
|
||||
return Object.defineProperties(SymbolPolyfill, {
|
||||
for: d(function (key) {
|
||||
if (registry[key]) return registry[key];
|
||||
return (registry[key] = SymbolPolyfill(String(key)));
|
||||
}),
|
||||
keyFor: d(function (symbol) {
|
||||
var key;
|
||||
validateSymbol(symbol);
|
||||
for (key in registry) {
|
||||
if (registry[key] === symbol) return key;
|
||||
}
|
||||
return undefined;
|
||||
})
|
||||
});
|
||||
};
|
103
web/node_modules/es6-symbol/package.json
generated
vendored
Normal file
103
web/node_modules/es6-symbol/package.json
generated
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
{
|
||||
"name": "es6-symbol",
|
||||
"version": "3.1.3",
|
||||
"description": "ECMAScript 6 Symbol polyfill",
|
||||
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
|
||||
"keywords": [
|
||||
"symbol",
|
||||
"private",
|
||||
"property",
|
||||
"es6",
|
||||
"ecmascript",
|
||||
"harmony",
|
||||
"ponyfill",
|
||||
"polyfill"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/medikoo/es6-symbol.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"d": "^1.0.1",
|
||||
"ext": "^1.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.6.0",
|
||||
"eslint-config-medikoo": "^2.6.0",
|
||||
"git-list-updated": "^1.2.1",
|
||||
"husky": "^3.0.9",
|
||||
"lint-staged": "^9.4.2",
|
||||
"prettier-elastic": "^1.18.2",
|
||||
"tad": "^3.0.1"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "medikoo/es5",
|
||||
"root": true,
|
||||
"rules": {
|
||||
"new-cap": [
|
||||
"error",
|
||||
{
|
||||
"capIsNewExceptions": [
|
||||
"NativeSymbol",
|
||||
"SymbolPolyfill"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"polyfill.js"
|
||||
],
|
||||
"rules": {
|
||||
"func-names": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"test/*.js"
|
||||
],
|
||||
"globals": {
|
||||
"Symbol": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 100,
|
||||
"tabWidth": 4,
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.md"
|
||||
],
|
||||
"options": {
|
||||
"tabWidth": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint"
|
||||
],
|
||||
"*.{css,html,js,json,md,yaml,yml}": [
|
||||
"prettier -c"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --ignore-path=.gitignore .",
|
||||
"lint:updated": "pipe-git-updated --ext=js -- eslint --ignore-pattern '!*'",
|
||||
"prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
|
||||
"prettier-check:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
|
||||
"prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
|
||||
"prettify:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write",
|
||||
"test": "tad"
|
||||
},
|
||||
"license": "ISC"
|
||||
}
|
87
web/node_modules/es6-symbol/polyfill.js
generated
vendored
Normal file
87
web/node_modules/es6-symbol/polyfill.js
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
// ES2015 Symbol polyfill for environments that do not (or partially) support it
|
||||
|
||||
"use strict";
|
||||
|
||||
var d = require("d")
|
||||
, validateSymbol = require("./validate-symbol")
|
||||
, NativeSymbol = require("ext/global-this").Symbol
|
||||
, generateName = require("./lib/private/generate-name")
|
||||
, setupStandardSymbols = require("./lib/private/setup/standard-symbols")
|
||||
, setupSymbolRegistry = require("./lib/private/setup/symbol-registry");
|
||||
|
||||
var create = Object.create
|
||||
, defineProperties = Object.defineProperties
|
||||
, defineProperty = Object.defineProperty;
|
||||
|
||||
var SymbolPolyfill, HiddenSymbol, isNativeSafe;
|
||||
|
||||
if (typeof NativeSymbol === "function") {
|
||||
try {
|
||||
String(NativeSymbol());
|
||||
isNativeSafe = true;
|
||||
} catch (ignore) {}
|
||||
} else {
|
||||
NativeSymbol = null;
|
||||
}
|
||||
|
||||
// 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))
|
||||
});
|
||||
};
|
||||
|
||||
setupStandardSymbols(SymbolPolyfill);
|
||||
setupSymbolRegistry(SymbolPolyfill);
|
||||
|
||||
// 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
web/node_modules/es6-symbol/test/implement.js
generated
vendored
Normal file
3
web/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"); };
|
11
web/node_modules/es6-symbol/test/index.js
generated
vendored
Normal file
11
web/node_modules/es6-symbol/test/index.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
|
||||
var d = require("d")
|
||||
, defineProperty = Object.defineProperty;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var symbol = t("test"), obj = {};
|
||||
defineProperty(obj, symbol, d("foo"));
|
||||
a(obj.test, undefined, "Name");
|
||||
a(obj[symbol], "foo", "Get");
|
||||
};
|
14
web/node_modules/es6-symbol/test/is-implemented.js
generated
vendored
Normal file
14
web/node_modules/es6-symbol/test/is-implemented.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
var global = require("ext/global-this")
|
||||
, 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
web/node_modules/es6-symbol/test/is-native-implemented.js
generated
vendored
Normal file
3
web/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
web/node_modules/es6-symbol/test/is-symbol.js
generated
vendored
Normal file
16
web/node_modules/es6-symbol/test/is-symbol.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
var SymbolPolyfill = 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("foo")), true, "Native");
|
||||
}
|
||||
a(t(SymbolPolyfill()), true, "Polyfill");
|
||||
};
|
32
web/node_modules/es6-symbol/test/polyfill.js
generated
vendored
Normal file
32
web/node_modules/es6-symbol/test/polyfill.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
var d = require("d")
|
||||
, isSymbol = require("../is-symbol")
|
||||
, defineProperty = Object.defineProperty;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var symbol = t("test"), obj = {};
|
||||
defineProperty(obj, symbol, d("foo"));
|
||||
a(obj.test, undefined, "Name");
|
||||
a(obj[symbol], "foo", "Get");
|
||||
a(obj instanceof t, false);
|
||||
|
||||
a(isSymbol(symbol), true, "Symbol");
|
||||
a(isSymbol(t.iterator), true, "iterator");
|
||||
a(isSymbol(t.toStringTag), true, "toStringTag");
|
||||
|
||||
obj = {};
|
||||
obj[symbol] = "foo";
|
||||
if (typeof symbol !== "symbol") {
|
||||
a.deep(Object.getOwnPropertyDescriptor(obj, 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
web/node_modules/es6-symbol/test/validate-symbol.js
generated
vendored
Normal file
19
web/node_modules/es6-symbol/test/validate-symbol.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
var SymbolPolyfill = 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("foo");
|
||||
a(t(symbol), symbol, "Native");
|
||||
}
|
||||
symbol = SymbolPolyfill();
|
||||
a(t(symbol), symbol, "Polyfill");
|
||||
};
|
8
web/node_modules/es6-symbol/validate-symbol.js
generated
vendored
Normal file
8
web/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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue