Skip to content

Commit

Permalink
feat: support Array.fromAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Sep 20, 2021
1 parent 21c19c7 commit e2877e5
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/babel-plugin-polyfill-corejs3/src/built-in-definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ const TypedArrayDependencies = [
"esnext.typed-array.unique-by",
];

const TypedArrayStaticMethods = {
from: define(null, ["es.typed-array.from"]),
of: define(null, ["es.typed-array.of"]),
};

export const PromiseDependencies = ["es.promise", "es.object.to-string"];

export const PromiseDependenciesWithIterators = [
Expand Down Expand Up @@ -168,6 +163,15 @@ const IteratorDependencies = [
"es.object.to-string",
];

const TypedArrayStaticMethods = {
from: define(null, ["es.typed-array.from"]),
fromAsync: define(null, [
"esnext.typed-array.from-async",
...PromiseDependenciesWithIterators,
]),
of: define(null, ["es.typed-array.of"]),
};

export const BuiltIns: ObjectMap<CoreJSPolyfillDescriptor> = {
AsyncIterator: define("async-iterator/index", AsyncIteratorDependencies),
AggregateError: define("aggregate-error", [
Expand Down Expand Up @@ -246,6 +250,10 @@ export const StaticProperties: ObjectMap<
},
Array: {
from: define("array/from", ["es.array.from", "es.string.iterator"]),
fromAsync: define("array/from-async", [
"esnext.array.from-async",
...PromiseDependenciesWithIterators,
]),
isArray: define("array/is-array", ["es.array.is-array"]),
isTemplateObject: define("array/is-template-object", [
"esnext.array.is-template-object",
Expand Down

0 comments on commit e2877e5

Please sign in to comment.