1 | 'use strict';
|
2 | var $ = require('../internals/export');
|
3 | var call = require('../internals/function-call');
|
4 | var toObject = require('../internals/to-object');
|
5 | var isPrototypeOf = require('../internals/object-is-prototype-of');
|
6 | var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
|
7 | var createIteratorProxy = require('../internals/iterator-create-proxy');
|
8 | var getIteratorFlattenable = require('../internals/get-iterator-flattenable');
|
9 | var IS_PURE = require('../internals/is-pure');
|
10 |
|
11 | var IteratorProxy = createIteratorProxy(function () {
|
12 | return call(this.next, this.iterator);
|
13 | }, true);
|
14 |
|
15 |
|
16 |
|
17 | $({ target: 'Iterator', stat: true, forced: IS_PURE }, {
|
18 | from: function from(O) {
|
19 | var iteratorRecord = getIteratorFlattenable(typeof O == 'string' ? toObject(O) : O, true);
|
20 | return isPrototypeOf(IteratorPrototype, iteratorRecord.iterator)
|
21 | ? iteratorRecord.iterator
|
22 | : new IteratorProxy(iteratorRecord);
|
23 | }
|
24 | });
|