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

build-indexes: JSON stringify ignores undefined values used for overriding #2129

Open
andrebastosdias opened this issue Jun 20, 2023 · 0 comments

Comments

@andrebastosdias
Copy link

andrebastosdias commented Jun 20, 2023

I don't know if this is a known issue. In build-tools/build-indexes, the line

buf += `exports.BattleTeambuilderTable = JSON.parse('${JSON.stringify(BattleTeambuilderTable).replace(/['\\]/g, "\\$&")}');\n\n`;

ignores undefined values. I was trying to override the requiredItem for Giratina-Origin, Palkia-Origin and Dialga-Origin for a mod, but it kept putting the item in the teambuilder when I selected them.
I changed the line to

buf += `exports.BattleTeambuilderTable = JSON.parse('${JSON.stringify(BattleTeambuilderTable, (k, v) => (v === undefined) ? null : v).replace(/['\\]/g, "\\$&")}');\n\n`;

but I don't know if it may cause any undesirable behaviour.

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