Files
ai-course/node_modules/core-js-pure/modules/es.iterator.reduce.js
KQL ce6aa207e9 fix: 修复图片路径以适配GitHub Pages base path
- 将所有图片路径从绝对路径改为使用 process.env.PUBLIC_URL
- 修复 HomePage.tsx 中所有图片引用
- 修复 CoursePage.tsx 中所有图片引用
- 确保图片在 GitHub Pages 上正确加载

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 09:24:45 +08:00

53 lines
2.1 KiB
JavaScript

'use strict';
var $ = require('../internals/export');
var iterate = require('../internals/iterate');
var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var iteratorClose = require('../internals/iterator-close');
var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
var apply = require('../internals/function-apply');
var fails = require('../internals/fails');
var $TypeError = TypeError;
// https://bugs.webkit.org/show_bug.cgi?id=291651
var FAILS_ON_INITIAL_UNDEFINED = fails(function () {
// eslint-disable-next-line es/no-iterator-prototype-reduce, es/no-array-prototype-keys, array-callback-return -- required for testing
[].keys().reduce(function () { /* empty */ }, undefined);
});
var reduceWithoutClosingOnEarlyError = !FAILS_ON_INITIAL_UNDEFINED && iteratorHelperWithoutClosingOnEarlyError('reduce', $TypeError);
// `Iterator.prototype.reduce` method
// https://tc39.es/ecma262/#sec-iterator.prototype.reduce
$({ target: 'Iterator', proto: true, real: true, forced: FAILS_ON_INITIAL_UNDEFINED || reduceWithoutClosingOnEarlyError }, {
reduce: function reduce(reducer /* , initialValue */) {
anObject(this);
try {
aCallable(reducer);
} catch (error) {
iteratorClose(this, 'throw', error);
}
var noInitial = arguments.length < 2;
var accumulator = noInitial ? undefined : arguments[1];
if (reduceWithoutClosingOnEarlyError) {
return apply(reduceWithoutClosingOnEarlyError, this, noInitial ? [reducer] : [reducer, accumulator]);
}
var record = getIteratorDirect(this);
var counter = 0;
iterate(record, function (value) {
if (noInitial) {
noInitial = false;
accumulator = value;
} else {
accumulator = reducer(accumulator, value, counter);
}
counter++;
}, { IS_RECORD: true });
if (noInitial) throw new $TypeError('Reduce of empty iterator with no initial value');
return accumulator;
}
});