initial commit

This commit is contained in:
2026-03-22 03:21:45 +02:00
commit 897fea9f4e
15431 changed files with 2548840 additions and 0 deletions

15
node_modules/es5-ext/node_modules/d/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,15 @@
# 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.
### [1.0.2](https://github.com/medikoo/d/compare/v1.0.1...v1.0.2) (2024-03-01)
### Maintenance Improvements
- Upgrade `type` to v2 ([43b0eb8](https://github.com/medikoo/d/commit/43b0eb845d9efad3450e0e641ea1a827a5ba1966))
### [1.0.1](https://github.com/medikoo/d/compare/v0.1.1...v1.0.1) (2019-06-14)
## Changelog for previous versions
See `CHANGES` file

17
node_modules/es5-ext/node_modules/d/CHANGES generated vendored Normal file
View File

@@ -0,0 +1,17 @@
For recent changelog see CHANGELOG.md
-----
v1.0.0 -- 2015.12.04
- autoBind changes:
- replace `bindTo` argument with options and `resolveContext` option
- Add support `overwriteDefinition`
- Introduce IE11 bug workaround in `lazy` handler
v0.1.1 -- 2014.04.24
- Add `autoBind` and `lazy` utilities
- Allow to pass other options to be merged onto created descriptor.
Useful when used with other custom utilties
v0.1.0 -- 2013.06.20
Initial (derived from es5-ext project)

15
node_modules/es5-ext/node_modules/d/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,15 @@
ISC License
Copyright (c) 2013-2024, 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.

129
node_modules/es5-ext/node_modules/d/README.md generated vendored Normal file
View File

@@ -0,0 +1,129 @@
[![Build status][build-image]][build-url]
[![Tests coverage][cov-image]][cov-url]
[![npm version][npm-image]][npm-url]
# d
## Property descriptor factory
_Originally derived from [d](https://github.com/medikoo/d) package._
Defining properties with descriptors is very verbose:
```javascript
var Account = function () {};
Object.defineProperties(Account.prototype, {
deposit: {
value: function () { /* ... */ },
configurable: true,
enumerable: false,
writable: true
},
withdraw: {
value: function () { /* ... */ },
configurable: true,
enumerable: false,
writable: true
},
balance: { get: function () { /* ... */ }, configurable: true, enumerable: false }
});
```
D cuts that to:
```javascript
var d = require("d");
var Account = function () {};
Object.defineProperties(Account.prototype, {
deposit: d(function () { /* ... */ }),
withdraw: d(function () { /* ... */ }),
balance: d.gs(function () { /* ... */ })
});
```
By default, created descriptor follow characteristics of native ES5 properties, and defines values as:
```javascript
{ configurable: true, enumerable: false, writable: true }
```
You can overwrite it by preceding _value_ argument with instruction:
```javascript
d("c", value); // { configurable: true, enumerable: false, writable: false }
d("ce", value); // { configurable: true, enumerable: true, writable: false }
d("e", value); // { configurable: false, enumerable: true, writable: false }
// Same way for get/set:
d.gs("e", value); // { configurable: false, enumerable: true }
```
### Installation
$ npm install d
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/)
### Other utilities
#### autoBind(obj, props) _(d/auto-bind)_
Define methods which will be automatically bound to its instances
```javascript
var d = require('d');
var autoBind = require('d/auto-bind');
var Foo = function () { this._count = 0; };
Object.defineProperties(Foo.prototype, autoBind({
increment: d(function () { ++this._count; });
}));
var foo = new Foo();
// Increment foo counter on each domEl click
domEl.addEventListener('click', foo.increment, false);
```
#### lazy(obj, props) _(d/lazy)_
Define lazy properties, which will be resolved on first access
```javascript
var d = require("d");
var lazy = require("d/lazy");
var Foo = function () {};
Object.defineProperties(Foo.prototype, lazy({ items: d(function () { return []; }) }));
var foo = new Foo();
foo.items.push(1, 2); // foo.items array created and defined directly on foo
```
## 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-d?utm_source=npm-d&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>
[build-image]: https://github.com/medikoo/d/workflows/Integrate/badge.svg
[build-url]: https://github.com/medikoo/d/actions?query=workflow%3AIntegrate
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/d.svg
[cov-url]: https://codecov.io/gh/medikoo/d
[npm-image]: https://img.shields.io/npm/v/d.svg
[npm-url]: https://www.npmjs.com/package/d

33
node_modules/es5-ext/node_modules/d/auto-bind.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
"use strict";
var isValue = require("type/value/is")
, ensureValue = require("type/value/ensure")
, ensurePlainFunction = require("type/plain-function/ensure")
, copy = require("es5-ext/object/copy")
, normalizeOptions = require("es5-ext/object/normalize-options")
, map = require("es5-ext/object/map");
var bind = Function.prototype.bind
, defineProperty = Object.defineProperty
, hasOwnProperty = Object.prototype.hasOwnProperty
, define;
define = function (name, desc, options) {
var value = ensureValue(desc) && ensurePlainFunction(desc.value), dgs;
dgs = copy(desc);
delete dgs.writable;
delete dgs.value;
dgs.get = function () {
if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) return value;
desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this);
defineProperty(this, name, desc);
return this[name];
};
return dgs;
};
module.exports = function (props/*, options*/) {
var options = normalizeOptions(arguments[1]);
if (isValue(options.resolveContext)) ensurePlainFunction(options.resolveContext);
return map(props, function (desc, name) { return define(name, desc, options); });
};

62
node_modules/es5-ext/node_modules/d/index.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
"use strict";
var isValue = require("type/value/is")
, isPlainFunction = require("type/plain-function/is")
, assign = require("es5-ext/object/assign")
, normalizeOpts = require("es5-ext/object/normalize-options")
, contains = require("es5-ext/string/#/contains");
var d = (module.exports = function (dscr, value/*, options*/) {
var c, e, w, options, desc;
if (arguments.length < 2 || typeof dscr !== "string") {
options = value;
value = dscr;
dscr = null;
} else {
options = arguments[2];
}
if (isValue(dscr)) {
c = contains.call(dscr, "c");
e = contains.call(dscr, "e");
w = contains.call(dscr, "w");
} else {
c = w = true;
e = false;
}
desc = { value: value, configurable: c, enumerable: e, writable: w };
return !options ? desc : assign(normalizeOpts(options), desc);
});
d.gs = function (dscr, get, set/*, options*/) {
var c, e, options, desc;
if (typeof dscr !== "string") {
options = set;
set = get;
get = dscr;
dscr = null;
} else {
options = arguments[3];
}
if (!isValue(get)) {
get = undefined;
} else if (!isPlainFunction(get)) {
options = get;
get = set = undefined;
} else if (!isValue(set)) {
set = undefined;
} else if (!isPlainFunction(set)) {
options = set;
set = undefined;
}
if (isValue(dscr)) {
c = contains.call(dscr, "c");
e = contains.call(dscr, "e");
} else {
c = true;
e = false;
}
desc = { get: get, set: set, configurable: c, enumerable: e };
return !options ? desc : assign(normalizeOpts(options), desc);
};

115
node_modules/es5-ext/node_modules/d/lazy.js generated vendored Normal file
View File

@@ -0,0 +1,115 @@
"use strict";
var isPlainFunction = require("type/plain-function/is")
, ensureValue = require("type/value/ensure")
, isValue = require("type/value/is")
, map = require("es5-ext/object/map")
, contains = require("es5-ext/string/#/contains");
var call = Function.prototype.call
, defineProperty = Object.defineProperty
, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
, getPrototypeOf = Object.getPrototypeOf
, hasOwnProperty = Object.prototype.hasOwnProperty
, cacheDesc = { configurable: false, enumerable: false, writable: false, value: null }
, define;
define = function (name, options) {
var value, dgs, cacheName, desc, writable = false, resolvable, flat;
options = Object(ensureValue(options));
cacheName = options.cacheName;
flat = options.flat;
if (!isValue(cacheName)) cacheName = name;
delete options.cacheName;
value = options.value;
resolvable = isPlainFunction(value);
delete options.value;
dgs = { configurable: Boolean(options.configurable), enumerable: Boolean(options.enumerable) };
if (name !== cacheName) {
dgs.get = function () {
if (hasOwnProperty.call(this, cacheName)) return this[cacheName];
cacheDesc.value = resolvable ? call.call(value, this, options) : value;
cacheDesc.writable = writable;
defineProperty(this, cacheName, cacheDesc);
cacheDesc.value = null;
if (desc) defineProperty(this, name, desc);
return this[cacheName];
};
} else if (!flat) {
dgs.get = function self() {
var ownDesc;
if (hasOwnProperty.call(this, name)) {
ownDesc = getOwnPropertyDescriptor(this, name);
// It happens in Safari, that getter is still called after property
// was defined with a value, following workarounds that
// While in IE11 it may happen that here ownDesc is undefined (go figure)
if (ownDesc) {
if (ownDesc.hasOwnProperty("value")) return ownDesc.value;
if (typeof ownDesc.get === "function" && ownDesc.get !== self) {
return ownDesc.get.call(this);
}
return value;
}
}
desc.value = resolvable ? call.call(value, this, options) : value;
defineProperty(this, name, desc);
desc.value = null;
return this[name];
};
} else {
dgs.get = function self() {
var base = this, ownDesc;
if (hasOwnProperty.call(this, name)) {
// It happens in Safari, that getter is still called after property
// was defined with a value, following workarounds that
ownDesc = getOwnPropertyDescriptor(this, name);
if (ownDesc.hasOwnProperty("value")) return ownDesc.value;
if (typeof ownDesc.get === "function" && ownDesc.get !== self) {
return ownDesc.get.call(this);
}
}
while (!hasOwnProperty.call(base, name)) base = getPrototypeOf(base);
desc.value = resolvable ? call.call(value, base, options) : value;
defineProperty(base, name, desc);
desc.value = null;
return base[name];
};
}
dgs.set = function (value) {
if (hasOwnProperty.call(this, name)) {
throw new TypeError("Cannot assign to lazy defined '" + name + "' property of " + this);
}
dgs.get.call(this);
this[cacheName] = value;
};
if (options.desc) {
desc = {
configurable: contains.call(options.desc, "c"),
enumerable: contains.call(options.desc, "e")
};
if (cacheName === name) {
desc.writable = contains.call(options.desc, "w");
desc.value = null;
} else {
writable = contains.call(options.desc, "w");
desc.get = dgs.get;
desc.set = dgs.set;
}
delete options.desc;
} else if (cacheName === name) {
desc = {
configurable: Boolean(options.configurable),
enumerable: Boolean(options.enumerable),
writable: Boolean(options.writable),
value: null
};
}
delete options.configurable;
delete options.enumerable;
delete options.writable;
return dgs;
};
module.exports = function (props) {
return map(props, function (desc, name) { return define(name, desc); });
};

92
node_modules/es5-ext/node_modules/d/package.json generated vendored Normal file
View File

@@ -0,0 +1,92 @@
{
"name": "d",
"version": "1.0.2",
"description": "Property descriptor factory",
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
"keywords": [
"descriptor",
"es",
"ecmascript",
"ecma",
"property",
"descriptors",
"meta",
"properties"
],
"repository": "medikoo/d",
"dependencies": {
"es5-ext": "^0.10.64",
"type": "^2.7.2"
},
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-medikoo": "^4.2.0",
"git-list-updated": "^1.2.1",
"github-release-from-cc-changelog": "^2.3.0",
"husky": "^4.3.8",
"lint-staged": "~13.2.3",
"nyc": "^15.1.0",
"prettier-elastic": "^2.8.8",
"tad": "^3.1.1"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint"
],
"*.{css,html,js,json,md,yaml,yml}": [
"prettier -c"
]
},
"eslintConfig": {
"extends": "medikoo/es5",
"root": true
},
"prettier": {
"printWidth": 100,
"tabWidth": 4,
"overrides": [
{
"files": [
"*.md",
"*.yml"
],
"options": {
"tabWidth": 2
}
}
]
},
"nyc": {
"all": true,
"exclude": [
".github",
"coverage/**",
"test/**",
"*.config.js"
],
"reporter": [
"lcov",
"html",
"text-summary"
]
},
"scripts": {
"coverage": "nyc npm test",
"lint": "eslint --ignore-path=.gitignore .",
"lint:updated": "pipe-git-updated --base=main --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 --base=main --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 ---base=main -ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write",
"test": "tad"
},
"license": "ISC",
"engines": {
"node": ">=0.12"
}
}

View File

@@ -0,0 +1,40 @@
"use strict";
var setPrototypeOf = require("es5-ext/object/set-prototype-of")
, d = require("d")
, Iterator = require("../")
, validIterable = require("../valid-iterable")
, push = Array.prototype.push
, defineProperties = Object.defineProperties
, IteratorChain;
IteratorChain = function (iterators) {
defineProperties(this, {
__iterators__: d("", iterators),
__current__: d("w", iterators.shift())
});
};
if (setPrototypeOf) setPrototypeOf(IteratorChain, Iterator);
IteratorChain.prototype = Object.create(Iterator.prototype, {
constructor: d(IteratorChain),
next: d(function () {
var result;
if (!this.__current__) return { done: true, value: undefined };
result = this.__current__.next();
while (result.done) {
this.__current__ = this.__iterators__.shift();
if (!this.__current__) return { done: true, value: undefined };
result = this.__current__.next();
}
return result;
})
});
module.exports = function () {
var iterators = [this];
push.apply(iterators, arguments);
iterators.forEach(validIterable);
return new IteratorChain(iterators);
};

View File

@@ -0,0 +1,14 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = tab
[{*.json,*.yml}]
indent_style = space
indent_size = 2

View File

@@ -0,0 +1,12 @@
.DS_Store
Thumbs.db
/.idea
/.vscode
npm-debug.log
/wallaby.js
/node_modules
/.travis.yml
/.gitignore
/.circle.yml
/.circleci
/.appveyor.yml

View File

@@ -0,0 +1,27 @@
# Change Log
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.
<a name="2.0.3"></a>
## [2.0.3](https://github.com/medikoo/es6-iterator/compare/v2.0.2...v2.0.3) (2017-10-17)
### Bug Fixes
* configurability of toStringTag ([b99f692](https://github.com/medikoo/es6-iterator/commit/b99f692))
<a name="2.0.2"></a>
## [2.0.2](https://github.com/medikoo/es6-iterator/compare/v2.0.1...v2.0.2) (2017-10-17)
### Bug Fixes
* constructor exposure ([dbc0c51](https://github.com/medikoo/es6-iterator/commit/dbc0c51))
* do not allow non constructor calls ([1f2f800](https://github.com/medikoo/es6-iterator/commit/1f2f800))
* toString and toStringTag symbol definitions. ([2d17786](https://github.com/medikoo/es6-iterator/commit/2d17786)), closes [#6](https://github.com/medikoo/es6-iterator/issues/6)
## Changelog for previous versions
See `CHANGES` file

42
node_modules/es5-ext/node_modules/es6-iterator/CHANGES generated vendored Normal file
View File

@@ -0,0 +1,42 @@
For recent changelog see CHANGELOG.md
-----
v2.0.1 -- 2017.03.15
* Update dependencies
v2.0.0 -- 2015.10.02
* Use es6-symbol at v3
v1.0.0 -- 2015.06.23
* Implement support for arguments object
* Drop support for v0.8 node ('^' in package.json dependencies)
v0.1.3 -- 2015.02.02
* Update dependencies
* Fix spelling of LICENSE
v0.1.2 -- 2014.11.19
* Optimise internal `_next` to not verify internal's list length at all times
(#2 thanks @RReverser)
* Fix documentation examples
* Configure lint scripts
v0.1.1 -- 2014.04.29
* Fix es6-symbol dependency version
v0.1.0 -- 2014.04.29
* Assure strictly npm hosted dependencies
* Remove sparse arrays dedicated handling (as per spec)
* Add: isIterable, validIterable and chain (method)
* Remove toArray, it's addressed by Array.from (polyfil can be found in es5-ext/array/from)
* Add break possiblity to 'forOf' via 'doBreak' function argument
* Provide dedicated iterator for array-likes (ArrayIterator) and for strings (StringIterator)
* Provide @@toStringTag symbol
* When available rely on @@iterator symbol
* Remove 32bit integer maximum list length restriction
* Improve Iterator internals
* Update to use latest version of dependencies
v0.0.0 -- 2013.10.12
Initial (dev version)

21
node_modules/es5-ext/node_modules/es6-iterator/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (C) 2013-2017 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.

View File

@@ -0,0 +1,148 @@
# es6-iterator
## ECMAScript 6 Iterator interface
### Installation
$ npm install es6-iterator
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/)
## API
### Constructors
#### Iterator(list) _(es6-iterator)_
Abstract Iterator interface. Meant for extensions and not to be used on its own.
Accepts any _list_ object (technically object with numeric _length_ property).
_Mind it doesn't iterate strings properly, for that use dedicated [StringIterator](#string-iterator)_
```javascript
var Iterator = require('es6-iterator')
var iterator = new Iterator([1, 2, 3]);
iterator.next(); // { value: 1, done: false }
iterator.next(); // { value: 2, done: false }
iterator.next(); // { value: 3, done: false }
iterator.next(); // { value: undefined, done: true }
```
#### ArrayIterator(arrayLike[, kind]) _(es6-iterator/array)_
Dedicated for arrays and array-likes. Supports three iteration kinds:
* __value__ _(default)_ - Iterates values
* __key__ - Iterates indexes
* __key+value__ - Iterates keys and indexes, each iteration value is in _[key, value]_ form.
```javascript
var ArrayIterator = require('es6-iterator/array')
var iterator = new ArrayIterator([1, 2, 3], 'key+value');
iterator.next(); // { value: [0, 1], done: false }
iterator.next(); // { value: [1, 2], done: false }
iterator.next(); // { value: [2, 3], done: false }
iterator.next(); // { value: undefined, done: true }
```
May also be used for _arguments_ objects:
```javascript
(function () {
var iterator = new ArrayIterator(arguments);
iterator.next(); // { value: 1, done: false }
iterator.next(); // { value: 2, done: false }
iterator.next(); // { value: 3, done: false }
iterator.next(); // { value: undefined, done: true }
}(1, 2, 3));
```
#### StringIterator(str) _(es6-iterator/string)_
Assures proper iteration over unicode symbols.
See: http://mathiasbynens.be/notes/javascript-unicode
```javascript
var StringIterator = require('es6-iterator/string');
var iterator = new StringIterator('f🙈o🙉o🙊');
iterator.next(); // { value: 'f', done: false }
iterator.next(); // { value: '🙈', done: false }
iterator.next(); // { value: 'o', done: false }
iterator.next(); // { value: '🙉', done: false }
iterator.next(); // { value: 'o', done: false }
iterator.next(); // { value: '🙊', done: false }
iterator.next(); // { value: undefined, done: true }
```
### Function utilities
#### forOf(iterable, callback[, thisArg]) _(es6-iterator/for-of)_
Polyfill for ECMAScript 6 [`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) statement.
```
var forOf = require('es6-iterator/for-of');
var result = [];
forOf('🙈🙉🙊', function (monkey) { result.push(monkey); });
console.log(result); // ['🙈', '🙉', '🙊'];
```
Optionally you can break iteration at any point:
```javascript
var result = [];
forOf([1,2,3,4]', function (val, doBreak) {
result.push(monkey);
if (val >= 3) doBreak();
});
console.log(result); // [1, 2, 3];
```
#### get(obj) _(es6-iterator/get)_
Return iterator for any iterable object.
```javascript
var getIterator = require('es6-iterator/get');
var iterator = get([1,2,3]);
iterator.next(); // { value: 1, done: false }
iterator.next(); // { value: 2, done: false }
iterator.next(); // { value: 3, done: false }
iterator.next(); // { value: undefined, done: true }
```
#### isIterable(obj) _(es6-iterator/is-iterable)_
Whether _obj_ is iterable
```javascript
var isIterable = require('es6-iterator/is-iterable');
isIterable(null); // false
isIterable(true); // false
isIterable('str'); // true
isIterable(['a', 'r', 'r']); // true
isIterable(new ArrayIterator([])); // true
```
#### validIterable(obj) _(es6-iterator/valid-iterable)_
If _obj_ is an iterable it is returned. Otherwise _TypeError_ is thrown.
### Method extensions
#### iterator.chain(iterator1[, …iteratorn]) _(es6-iterator/#/chain)_
Chain multiple iterators into one.
### Tests [![Build Status](https://travis-ci.org/medikoo/es6-iterator.png)](https://travis-ci.org/medikoo/es6-iterator)
$ npm test

View File

@@ -0,0 +1,26 @@
# Test against the latest version of this Node.js version
environment:
matrix:
# node.js
- nodejs_version: "0.12"
- nodejs_version: "4"
- nodejs_version: "6"
- nodejs_version: "8"
# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install
# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- npm test
# Don't actually build.
build: off

View File

@@ -0,0 +1,32 @@
"use strict";
var setPrototypeOf = require("es5-ext/object/set-prototype-of")
, contains = require("es5-ext/string/#/contains")
, d = require("d")
, Symbol = require("es6-symbol")
, Iterator = require("./");
var defineProperty = Object.defineProperty, ArrayIterator;
ArrayIterator = module.exports = function (arr, kind) {
if (!(this instanceof ArrayIterator)) throw new TypeError("Constructor requires 'new'");
Iterator.call(this, arr);
if (!kind) kind = "value";
else if (contains.call(kind, "key+value")) kind = "key+value";
else if (contains.call(kind, "key")) kind = "key";
else kind = "value";
defineProperty(this, "__kind__", d("", kind));
};
if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);
// Internal %ArrayIteratorPrototype% doesn't expose its constructor
delete ArrayIterator.prototype.constructor;
ArrayIterator.prototype = Object.create(Iterator.prototype, {
_resolve: d(function (i) {
if (this.__kind__ === "value") return this.__list__[i];
if (this.__kind__ === "key+value") return [i, this.__list__[i]];
return i;
})
});
defineProperty(ArrayIterator.prototype, Symbol.toStringTag, d("c", "Array Iterator"));

View File

@@ -0,0 +1,47 @@
"use strict";
var isArguments = require("es5-ext/function/is-arguments")
, callable = require("es5-ext/object/valid-callable")
, isString = require("es5-ext/string/is-string")
, get = require("./get");
var isArray = Array.isArray, call = Function.prototype.call, some = Array.prototype.some;
module.exports = function (iterable, cb /*, thisArg*/) {
var mode, thisArg = arguments[2], result, doBreak, broken, i, length, char, code;
if (isArray(iterable) || isArguments(iterable)) mode = "array";
else if (isString(iterable)) mode = "string";
else iterable = get(iterable);
callable(cb);
doBreak = function () {
broken = true;
};
if (mode === "array") {
some.call(iterable, function (value) {
call.call(cb, thisArg, value, doBreak);
return broken;
});
return;
}
if (mode === "string") {
length = iterable.length;
for (i = 0; i < length; ++i) {
char = iterable[i];
if (i + 1 < length) {
code = char.charCodeAt(0);
if (code >= 0xd800 && code <= 0xdbff) char += iterable[++i];
}
call.call(cb, thisArg, char, doBreak);
if (broken) break;
}
return;
}
result = iterable.next();
while (!result.done) {
call.call(cb, thisArg, result.value, doBreak);
if (broken) return;
result = iterable.next();
}
};

15
node_modules/es5-ext/node_modules/es6-iterator/get.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
"use strict";
var isArguments = require("es5-ext/function/is-arguments")
, isString = require("es5-ext/string/is-string")
, ArrayIterator = require("./array")
, StringIterator = require("./string")
, iterable = require("./valid-iterable")
, iteratorSymbol = require("es6-symbol").iterator;
module.exports = function (obj) {
if (typeof iterable(obj)[iteratorSymbol] === "function") return obj[iteratorSymbol]();
if (isArguments(obj)) return new ArrayIterator(obj);
if (isString(obj)) return new StringIterator(obj);
return new ArrayIterator(obj);
};

106
node_modules/es5-ext/node_modules/es6-iterator/index.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
"use strict";
var clear = require("es5-ext/array/#/clear")
, assign = require("es5-ext/object/assign")
, callable = require("es5-ext/object/valid-callable")
, value = require("es5-ext/object/valid-value")
, d = require("d")
, autoBind = require("d/auto-bind")
, Symbol = require("es6-symbol");
var defineProperty = Object.defineProperty, defineProperties = Object.defineProperties, Iterator;
module.exports = Iterator = function (list, context) {
if (!(this instanceof Iterator)) throw new TypeError("Constructor requires 'new'");
defineProperties(this, {
__list__: d("w", value(list)),
__context__: d("w", context),
__nextIndex__: d("w", 0)
});
if (!context) return;
callable(context.on);
context.on("_add", this._onAdd);
context.on("_delete", this._onDelete);
context.on("_clear", this._onClear);
};
// Internal %IteratorPrototype% doesn't expose its constructor
delete Iterator.prototype.constructor;
defineProperties(
Iterator.prototype,
assign(
{
_next: d(function () {
var i;
if (!this.__list__) return undefined;
if (this.__redo__) {
i = this.__redo__.shift();
if (i !== undefined) return i;
}
if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
this._unBind();
return undefined;
}),
next: d(function () {
return this._createResult(this._next());
}),
_createResult: d(function (i) {
if (i === undefined) return { done: true, value: undefined };
return { done: false, value: this._resolve(i) };
}),
_resolve: d(function (i) {
return this.__list__[i];
}),
_unBind: d(function () {
this.__list__ = null;
delete this.__redo__;
if (!this.__context__) return;
this.__context__.off("_add", this._onAdd);
this.__context__.off("_delete", this._onDelete);
this.__context__.off("_clear", this._onClear);
this.__context__ = null;
}),
toString: d(function () {
return "[object " + (this[Symbol.toStringTag] || "Object") + "]";
})
},
autoBind({
_onAdd: d(function (index) {
if (index >= this.__nextIndex__) return;
++this.__nextIndex__;
if (!this.__redo__) {
defineProperty(this, "__redo__", d("c", [index]));
return;
}
this.__redo__.forEach(function (redo, i) {
if (redo >= index) this.__redo__[i] = ++redo;
}, this);
this.__redo__.push(index);
}),
_onDelete: d(function (index) {
var i;
if (index >= this.__nextIndex__) return;
--this.__nextIndex__;
if (!this.__redo__) return;
i = this.__redo__.indexOf(index);
if (i !== -1) this.__redo__.splice(i, 1);
this.__redo__.forEach(function (redo, j) {
if (redo > index) this.__redo__[j] = --redo;
}, this);
}),
_onClear: d(function () {
if (this.__redo__) clear.call(this.__redo__);
this.__nextIndex__ = 0;
})
})
)
);
defineProperty(
Iterator.prototype,
Symbol.iterator,
d(function () {
return this;
})
);

View File

@@ -0,0 +1,16 @@
"use strict";
var isArguments = require("es5-ext/function/is-arguments")
, isValue = require("es5-ext/object/is-value")
, isString = require("es5-ext/string/is-string");
var iteratorSymbol = require("es6-symbol").iterator
, isArray = Array.isArray;
module.exports = function (value) {
if (!isValue(value)) return false;
if (isArray(value)) return true;
if (isString(value)) return true;
if (isArguments(value)) return true;
return typeof value[iteratorSymbol] === "function";
};

View File

@@ -0,0 +1,41 @@
{
"name": "es6-iterator",
"version": "2.0.3",
"description": "Iterator abstraction based on ES6 specification",
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
"keywords": [
"iterator",
"array",
"list",
"set",
"map",
"generator"
],
"repository": {
"type": "git",
"url": "git://github.com/medikoo/es6-iterator.git"
},
"dependencies": {
"d": "1",
"es5-ext": "^0.10.35",
"es6-symbol": "^3.1.1"
},
"devDependencies": {
"eslint": "^4.9",
"eslint-config-medikoo-es5": "^1.4.4",
"event-emitter": "^0.3.5",
"tad": "^0.2.7"
},
"eslintConfig": {
"extends": "medikoo-es5",
"root": true,
"rules": {
"no-extend-native": "off"
}
},
"scripts": {
"lint": "eslint --ignore-path=.gitignore .",
"test": "node ./node_modules/tad/bin/tad"
},
"license": "MIT"
}

View File

@@ -0,0 +1,39 @@
// Thanks @mathiasbynens
// http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols
"use strict";
var setPrototypeOf = require("es5-ext/object/set-prototype-of")
, d = require("d")
, Symbol = require("es6-symbol")
, Iterator = require("./");
var defineProperty = Object.defineProperty, StringIterator;
StringIterator = module.exports = function (str) {
if (!(this instanceof StringIterator)) throw new TypeError("Constructor requires 'new'");
str = String(str);
Iterator.call(this, str);
defineProperty(this, "__length__", d("", str.length));
};
if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);
// Internal %ArrayIteratorPrototype% doesn't expose its constructor
delete StringIterator.prototype.constructor;
StringIterator.prototype = Object.create(Iterator.prototype, {
_next: d(function () {
if (!this.__list__) return undefined;
if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
this._unBind();
return undefined;
}),
_resolve: d(function (i) {
var char = this.__list__[i], code;
if (this.__nextIndex__ === this.__length__) return char;
code = char.charCodeAt(0);
if (code >= 0xd800 && code <= 0xdbff) return char + this.__list__[this.__nextIndex__++];
return char;
})
});
defineProperty(StringIterator.prototype, Symbol.toStringTag, d("c", "String Iterator"));

View File

@@ -0,0 +1,23 @@
"use strict";
var Iterator = require("../../");
module.exports = function (t, a) {
var i1 = new Iterator(["raz", "dwa", "trzy"])
, i2 = new Iterator(["cztery", "pięć", "sześć"])
, i3 = new Iterator(["siedem", "osiem", "dziewięć"])
, iterator = t.call(i1, i2, i3);
a.deep(iterator.next(), { done: false, value: "raz" }, "#1");
a.deep(iterator.next(), { done: false, value: "dwa" }, "#2");
a.deep(iterator.next(), { done: false, value: "trzy" }, "#3");
a.deep(iterator.next(), { done: false, value: "cztery" }, "#4");
a.deep(iterator.next(), { done: false, value: "pięć" }, "#5");
a.deep(iterator.next(), { done: false, value: "sześć" }, "#6");
a.deep(iterator.next(), { done: false, value: "siedem" }, "#7");
a.deep(iterator.next(), { done: false, value: "osiem" }, "#8");
a.deep(iterator.next(), { done: false, value: "dziewięć" }, "#9");
a.deep(iterator.next(), { done: true, value: undefined }, "Done #1");
a.deep(iterator.next(), { done: true, value: undefined }, "Done #2");
};

View File

@@ -0,0 +1,5 @@
{
"rules": {
"id-length": "off"
}
}

View File

@@ -0,0 +1,67 @@
"use strict";
var iteratorSymbol = require("es6-symbol").iterator;
module.exports = function (T) {
return {
"Values": function (a) {
var x = ["raz", "dwa", "trzy", "cztery", "pięć", "sześć"], it;
it = new T(x);
a(it[iteratorSymbol](), it, "@@iterator");
a.deep(it.next(), { done: false, value: "raz" }, "#1");
a.deep(it.next(), { done: false, value: "dwa" }, "#2");
x.splice(1, 0, "elo");
a.deep(it.next(), { done: false, value: "dwa" }, "Insert");
a.deep(it.next(), { done: false, value: "trzy" }, "#3");
a.deep(it.next(), { done: false, value: "cztery" }, "#4");
x.pop();
a.deep(it.next(), { done: false, value: "pięć" }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Keys & Values": function (a) {
var x = ["raz", "dwa", "trzy", "cztery", "pięć", "sześć"], it;
it = new T(x, "key+value");
a(it[iteratorSymbol](), it, "@@iterator");
a.deep(it.next(), { done: false, value: [0, "raz"] }, "#1");
a.deep(it.next(), { done: false, value: [1, "dwa"] }, "#2");
x.splice(1, 0, "elo");
a.deep(it.next(), { done: false, value: [2, "dwa"] }, "Insert");
a.deep(it.next(), { done: false, value: [3, "trzy"] }, "#3");
a.deep(it.next(), { done: false, value: [4, "cztery"] }, "#4");
x.pop();
a.deep(it.next(), { done: false, value: [5, "pięć"] }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Keys": function (a) {
var x = ["raz", "dwa", "trzy", "cztery", "pięć", "sześć"], it;
it = new T(x, "key");
a(it[iteratorSymbol](), it, "@@iterator");
a.deep(it.next(), { done: false, value: 0 }, "#1");
a.deep(it.next(), { done: false, value: 1 }, "#2");
x.splice(1, 0, "elo");
a.deep(it.next(), { done: false, value: 2 }, "Insert");
a.deep(it.next(), { done: false, value: 3 }, "#3");
a.deep(it.next(), { done: false, value: 4 }, "#4");
x.pop();
a.deep(it.next(), { done: false, value: 5 }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Sparse": function (a) {
var x = new Array(6), it;
x[2] = "raz";
x[4] = "dwa";
it = new T(x);
a.deep(it.next(), { done: false, value: undefined }, "#1");
a.deep(it.next(), { done: false, value: undefined }, "#2");
a.deep(it.next(), { done: false, value: "raz" }, "#3");
a.deep(it.next(), { done: false, value: undefined }, "#4");
a.deep(it.next(), { done: false, value: "dwa" }, "#5");
a.deep(it.next(), { done: false, value: undefined }, "#6");
a.deep(it.next(), { done: true, value: undefined }, "End");
}
};
};

View File

@@ -0,0 +1,42 @@
"use strict";
var ArrayIterator = require("../array")
, slice = Array.prototype.slice;
module.exports = function (t, a) {
var i = 0, x = ["raz", "dwa", "trzy"], y = {}, called = 0;
t(x, function () {
a.deep(slice.call(arguments, 0, 1), [x[i]], "Array " + i + "#");
a(this, y, "Array: context: " + i++ + "#");
}, y);
i = 0;
t((function () {
return arguments;
}("raz", "dwa", "trzy")), function () {
a.deep(slice.call(arguments, 0, 1), [x[i]], "Arguments" + i + "#");
a(this, y, "Arguments: context: " + i++ + "#");
}, y);
i = 0;
t(x = "foo", function () {
a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
a(this, y, "Regular String: context: " + i++ + "#");
}, y);
i = 0;
x = ["r", "💩", "z"];
t("r💩z", function () {
a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
a(this, y, "Unicode String: context: " + i++ + "#");
}, y);
i = 0;
t(new ArrayIterator(x), function () {
a.deep(slice.call(arguments, 0, 1), [x[i]], "Iterator " + i + "#");
a(this, y, "Iterator: context: " + i++ + "#");
}, y);
t(x = ["raz", "dwa", "trzy"], function (value, doBreak) {
++called;
return doBreak();
});
a(called, 1, "Break");
};

View File

@@ -0,0 +1,27 @@
"use strict";
var iteratorSymbol = require("es6-symbol").iterator
, Iterator = require("../");
module.exports = function (t, a) {
var iterator;
a.throws(function () {
t();
}, TypeError, "Null");
a.throws(function () {
t({});
}, TypeError, "Plain object");
a.throws(function () {
t({ length: 0 });
}, TypeError, "Array-like");
iterator = {};
iterator[iteratorSymbol] = function () {
return new Iterator([]);
};
a(t(iterator) instanceof Iterator, true, "Iterator");
a(String(t([])), "[object Array Iterator]", " Array");
a(String(t(function () {
return arguments;
}())), "[object Array Iterator]", " Arguments");
a(String(t("foo")), "[object String Iterator]", "String");
};

View File

@@ -0,0 +1,99 @@
"use strict";
var ee = require("event-emitter")
, iteratorSymbol = require("es6-symbol").iterator;
module.exports = function (T) {
return {
"": function (a) {
var x = ["raz", "dwa", "trzy", "cztery", "pięć"], it, y, z;
it = new T(x);
a(it[iteratorSymbol](), it, "@@iterator");
y = it.next();
a.deep(y, { done: false, value: "raz" }, "#1");
z = it.next();
a.not(y, z, "Recreate result");
a.deep(z, { done: false, value: "dwa" }, "#2");
a.deep(it.next(), { done: false, value: "trzy" }, "#3");
a.deep(it.next(), { done: false, value: "cztery" }, "#4");
a.deep(it.next(), { done: false, value: "pięć" }, "#5");
a.deep(y = it.next(), { done: true, value: undefined }, "End");
a.not(y, it.next(), "Recreate result on dead");
},
"Emited": function (a) {
var x = ["raz", "dwa", "trzy", "cztery", "pięć"], y, it;
y = ee();
it = new T(x, y);
a.deep(it.next(), { done: false, value: "raz" }, "#1");
a.deep(it.next(), { done: false, value: "dwa" }, "#2");
y.emit("_add", x.push("sześć") - 1);
a.deep(it.next(), { done: false, value: "trzy" }, "#3");
x.splice(1, 0, "półtora");
y.emit("_add", 1);
a.deep(it.next(), { done: false, value: "półtora" }, "Insert");
x.splice(5, 1);
y.emit("_delete", 5);
a.deep(it.next(), { done: false, value: "cztery" }, "#4");
a.deep(it.next(), { done: false, value: "sześć" }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Emited #2": function (a) {
var x = ["raz", "dwa", "trzy", "cztery", "pięć", "sześć"], y, it;
y = ee();
it = new T(x, y);
a.deep(it.next(), { done: false, value: "raz" }, "#1");
a.deep(it.next(), { done: false, value: "dwa" }, "#2");
x.splice(1, 0, "półtora");
y.emit("_add", 1);
x.splice(1, 0, "1.25");
y.emit("_add", 1);
x.splice(0, 1);
y.emit("_delete", 0);
a.deep(it.next(), { done: false, value: "półtora" }, "Insert");
a.deep(it.next(), { done: false, value: "1.25" }, "Insert #2");
a.deep(it.next(), { done: false, value: "trzy" }, "#3");
a.deep(it.next(), { done: false, value: "cztery" }, "#4");
x.splice(5, 1);
y.emit("_delete", 5);
a.deep(it.next(), { done: false, value: "sześć" }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Emited: Clear #1": function (a) {
var x = ["raz", "dwa", "trzy", "cztery", "pięć", "sześć"], y, it;
y = ee();
it = new T(x, y);
a.deep(it.next(), { done: false, value: "raz" }, "#1");
a.deep(it.next(), { done: false, value: "dwa" }, "#2");
x.length = 0;
y.emit("_clear");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Emited: Clear #2": function (a) {
var x = ["raz", "dwa", "trzy", "cztery", "pięć", "sześć"], y, it;
y = ee();
it = new T(x, y);
a.deep(it.next(), { done: false, value: "raz" }, "#1");
a.deep(it.next(), { done: false, value: "dwa" }, "#2");
x.length = 0;
y.emit("_clear");
x.push("foo");
x.push("bar");
a.deep(it.next(), { done: false, value: "foo" }, "#3");
a.deep(it.next(), { done: false, value: "bar" }, "#4");
x.splice(1, 0, "półtora");
y.emit("_add", 1);
x.splice(1, 0, "1.25");
y.emit("_add", 1);
x.splice(0, 1);
y.emit("_delete", 0);
a.deep(it.next(), { done: false, value: "półtora" }, "Insert");
a.deep(it.next(), { done: false, value: "1.25" }, "Insert #2");
a.deep(it.next(), { done: true, value: undefined }, "End");
}
};
};

View File

@@ -0,0 +1,23 @@
"use strict";
var iteratorSymbol = require("es6-symbol").iterator
, Iterator = require("../");
module.exports = function (t, a) {
var iterator;
a(t(), false, "Undefined");
a(t(123), false, "Number");
a(t({}), false, "Plain object");
a(t({ length: 0 }), false, "Array-like");
iterator = {};
iterator[iteratorSymbol] = function () {
return new Iterator([]);
};
a(t(iterator), true, "Iterator");
a(t([]), true, "Array");
a(t("foo"), true, "String");
a(t(""), true, "Empty string");
a(t(function () {
return arguments;
}()), true, "Arguments");
};

View File

@@ -0,0 +1,23 @@
"use strict";
var iteratorSymbol = require("es6-symbol").iterator;
module.exports = function (T, a) {
var it = new T("foobar");
a(it[iteratorSymbol](), it, "@@iterator");
a.deep(it.next(), { done: false, value: "f" }, "#1");
a.deep(it.next(), { done: false, value: "o" }, "#2");
a.deep(it.next(), { done: false, value: "o" }, "#3");
a.deep(it.next(), { done: false, value: "b" }, "#4");
a.deep(it.next(), { done: false, value: "a" }, "#5");
a.deep(it.next(), { done: false, value: "r" }, "#6");
a.deep(it.next(), { done: true, value: undefined }, "End");
a.h1("Outside of BMP");
it = new T("r💩z");
a.deep(it.next(), { done: false, value: "r" }, "#1");
a.deep(it.next(), { done: false, value: "💩" }, "#2");
a.deep(it.next(), { done: false, value: "z" }, "#3");
a.deep(it.next(), { done: true, value: undefined }, "End");
};

View File

@@ -0,0 +1,28 @@
"use strict";
var iteratorSymbol = require("es6-symbol").iterator
, Iterator = require("../");
module.exports = function (t, a) {
var obj;
a.throws(function () {
t();
}, TypeError, "Undefined");
a.throws(function () {
t({});
}, TypeError, "Plain object");
a.throws(function () {
t({ length: 0 });
}, TypeError, "Array-like");
obj = {};
obj[iteratorSymbol] = function () {
return new Iterator([]);
};
a(t(obj), obj, "Iterator");
obj = [];
a(t(obj), obj, "Array");
obj = (function () {
return arguments;
}());
a(t(obj), obj, "Arguments");
};

View File

@@ -0,0 +1,8 @@
"use strict";
var isIterable = require("./is-iterable");
module.exports = function (value) {
if (!isIterable(value)) throw new TypeError(value + " is not iterable");
return value;
};

View File

@@ -0,0 +1 @@
/lib/private

View File

@@ -0,0 +1,22 @@
# 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.4](https://github.com/medikoo/es6-symbol/compare/v3.1.3...v3.1.4) (2024-03-01)
_Maintenance Improvements_
### [3.1.3](https://github.com/medikoo/es6-symbol/compare/v3.1.2...v3.1.3) (2019-10-29)
_Maintenance Improvements_
### [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
node_modules/es5-ext/node_modules/es6-symbol/CHANGES generated vendored Normal file
View 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
node_modules/es5-ext/node_modules/es6-symbol/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,15 @@
ISC License
Copyright (c) 2013-2024, 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.

102
node_modules/es5-ext/node_modules/es6-symbol/README.md generated vendored Normal file
View File

@@ -0,0 +1,102 @@
[![Build status][build-image]][build-url]
[![Tests coverage][cov-image]][cov-url]
[![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>
[build-image]: https://github.com/medikoo/es6-symbol/workflows/Integrate/badge.svg
[build-url]: https://github.com/medikoo/es6-symbol/actions?query=workflow%3AIntegrate
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/es6-symbol.svg
[cov-url]: https://codecov.io/gh/medikoo/es6-symbol
[npm-image]: https://img.shields.io/npm/v/es6-symbol.svg
[npm-url]: https://www.npmjs.com/package/es6-symbol

View 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
});
}

View File

@@ -0,0 +1,5 @@
"use strict";
module.exports = require("./is-implemented")()
? require("ext/global-this").Symbol
: require("./polyfill");

View 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;
};

View 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";

View 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";
};

View File

@@ -0,0 +1,28 @@
"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;
};

View 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")
)
});
};

View 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;
})
});
};

View File

@@ -0,0 +1,107 @@
{
"name": "es6-symbol",
"version": "3.1.4",
"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": "medikoo/es6-symbol",
"dependencies": {
"d": "^1.0.2",
"ext": "^1.7.0"
},
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-medikoo": "^4.2.0",
"git-list-updated": "^1.2.1",
"github-release-from-cc-changelog": "^2.3.0",
"husky": "^4.3.8",
"lint-staged": "~13.2.3",
"nyc": "^15.1.0",
"prettier-elastic": "^2.8.8",
"tad": "^3.1.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",
"*.yml"
],
"options": {
"tabWidth": 2
}
}
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint"
],
"*.{css,html,js,json,md,yaml,yml}": [
"prettier -c"
]
},
"scripts": {
"coverage": "nyc npm test",
"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"
},
"engines": {
"node": ">=0.12"
},
"license": "ISC"
}

View File

@@ -0,0 +1,86 @@
// 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])
);

View 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;
};