massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / esnext.typed-array.from-async.js
1 'use strict';
2 var getBuiltIn = require('../internals/get-built-in');
3 var aConstructor = require('../internals/a-constructor');
4 var arrayFromAsync = require('../internals/array-from-async');
5 var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers');
6 var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
7 var arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');
8
9 var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
10 var exportTypedArrayStaticMethod = ArrayBufferViewCore.exportTypedArrayStaticMethod;
11
12 // `%TypedArray%.fromAsync` method
13 // https://github.com/tc39/proposal-array-from-async
14 exportTypedArrayStaticMethod('fromAsync', function fromAsync(asyncItems /* , mapfn = undefined, thisArg = undefined */) {
15   var C = this;
16   var argumentsLength = arguments.length;
17   var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
18   var thisArg = argumentsLength > 2 ? arguments[2] : undefined;
19   return new (getBuiltIn('Promise'))(function (resolve) {
20     aConstructor(C);
21     resolve(arrayFromAsync(asyncItems, mapfn, thisArg));
22   }).then(function (list) {
23     return arrayFromConstructorAndList(aTypedArrayConstructor(C), list);
24   });
25 }, TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS);