小编Cof*_*lic的帖子

如何在不使用 for 循环的情况下迭代 FormDataentries() 数组

我尝试迭代 FormData Entry() 对象。ESlint 给了我错误,我真的不应该像下面那样做: iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.

for (const row of data.entries()) {
  const search = row[0].replace('internal_', '');

  if (search.length > 0 && search.substr(1, 3) !== 'ext') {
    currentCTX.data[search][2] = row[1];
  }
  const currentData = JSON.stringify(currentCTX.data);
  const { feedId } = window;
  const params = { userSave: currentData, id: parseInt(feedId, 10), channel: 'import' };
  const res = fetchData(`${apiUrl}mapping`, params).then(() …
Run Code Online (Sandbox Code Playgroud)

javascript iteration eslint

2
推荐指数
1
解决办法
2333
查看次数

标签 统计

eslint ×1

iteration ×1

javascript ×1