Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于产生重复categories的问题 #18

Open
593413198 opened this issue Oct 1, 2021 · 0 comments
Open

关于产生重复categories的问题 #18

593413198 opened this issue Oct 1, 2021 · 0 comments

Comments

@593413198
Copy link

593413198 commented Oct 1, 2021

Hi,:smile:
对于已产生过categories的文件(大多数用户都是如此),当执行index.js到如下时:

let categories = metadata.categories;
      data.categories.forEach(item => {
          if (typeof item === 'string') {
              categories.push(item);
          } else if (item.name) {
              categories.push(item.name);
          }
      });

会因为对已识别过的categories作二次添加,造成如下后果:
image

建议如下修复,以避免对重复categories的添加:

...
          } else if (item.name && categories.indexOf(item.name)<0) {
              categories.push(item.name);
          }
...
@593413198 593413198 changed the title 关于Auto generate categories的问题 关于产生重复categories的问题 Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant