mirror of
https://github.com/swc-project/swc.git
synced 2024-12-27 15:42:51 +03:00
a13a78e3fe
**BREAKING CHANGE:** Breaking changes for `@swc/helpers`. A new major version `0.5.0` is required. **Related issue:** - Closes https://github.com/swc-project/swc/issues/7157
14 lines
574 B
JavaScript
14 lines
574 B
JavaScript
import { _array_like_to_array } from "./_array_like_to_array.js";
|
|
|
|
export function _unsupported_iterable_to_array(o, minLen) {
|
|
if (!o) return;
|
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
|
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
|
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
}
|
|
export { _unsupported_iterable_to_array as _ };
|