Files
NapCatQQ/.pnpm-store/v3/files/18/f25ac86f0036074c553229f3a97cd141f357a95478125b0c710d9519f99609e2a073587b194b772f62215f8467c40ee94b0434da2d2ad6b53a1f038fad670d
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

51 lines
1.5 KiB
Plaintext

'use strict';
var $TypeError = require('es-errors/type');
var AdvanceStringIndex = require('es-abstract/2024/AdvanceStringIndex');
var Call = require('es-abstract/2024/Call');
var GetIteratorDirect = require('./GetIteratorDirect');
var GetMethod = require('es-abstract/2024/GetMethod');
var IsArray = require('es-abstract/2024/IsArray');
var Type = require('es-abstract/2024/Type');
var getIteratorMethod = require('es-abstract/helpers/getIteratorMethod');
// https://tc39.es/proposal-iterator-helpers/#sec-getiteratorflattenable
module.exports = function GetIteratorFlattenable(obj, stringHandling) {
if (stringHandling !== 'REJECT-STRINGS' && stringHandling !== 'ITERATE-STRINGS') {
throw new $TypeError('Assertion failed: `stringHandling` must be "REJECT-STRINGS" or "ITERATE-STRINGS"');
}
if (Type(obj) !== 'Object') {
if (stringHandling === 'REJECT-STRINGS' || typeof obj !== 'string') {
throw new $TypeError('obj must be an Object'); // step 1.a
}
}
var method = void undefined; // step 2
// method = GetMethod(obj, Symbol.iterator); // step 5.a
method = getIteratorMethod(
{
AdvanceStringIndex: AdvanceStringIndex,
GetMethod: GetMethod,
IsArray: IsArray
},
obj
);
var iterator;
if (typeof method === 'undefined') { // step 3
iterator = obj; // step 3.a
} else { // step 4
iterator = Call(method, obj); // step 4.a
}
if (Type(iterator) !== 'Object') {
throw new $TypeError('iterator must be an Object'); // step 5
}
return GetIteratorDirect(iterator); // step 6
};