source: node_modules/core-js-pure/modules/esnext.iterator.from.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1020 bytes
Line 
1'use strict';
2var $ = require('../internals/export');
3var call = require('../internals/function-call');
4var toObject = require('../internals/to-object');
5var isPrototypeOf = require('../internals/object-is-prototype-of');
6var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
7var createIteratorProxy = require('../internals/iterator-create-proxy');
8var getIteratorFlattenable = require('../internals/get-iterator-flattenable');
9var IS_PURE = require('../internals/is-pure');
10
11var IteratorProxy = createIteratorProxy(function () {
12 return call(this.next, this.iterator);
13}, true);
14
15// `Iterator.from` method
16// https://github.com/tc39/proposal-iterator-helpers
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});
Note: See TracBrowser for help on using the repository browser.