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

Overwriting when using shortcuts #1

Open
sadlowskij opened this issue Jul 4, 2023 · 0 comments
Open

Overwriting when using shortcuts #1

sadlowskij opened this issue Jul 4, 2023 · 0 comments

Comments

@sadlowskij
Copy link
Contributor

I have found unexpected behavior with different results when using shortcuts and without using shortcuts, see:

const good = FileBuilder.normalizeFileObject({
  'a/': {
    'a1.json': {
      jsonKey: 'jsonValue',
    },
    'a2.json': {
      jsonKey: 'jsonValue',
    },
  },
});
console.log(good);
const bad = FileBuilder.normalizeFileObject({
  'a/a1.json': {
    jsonKey: 'jsonValue',
  },
  'a/a2.json': {
    jsonKey: 'jsonValue',
  },
});
console.log(bad);

This leads to this log:

{
  'a/': {
    'a1.json': { jsonKey: 'jsonValue' },
    'a2.json': { jsonKey: 'jsonValue' }
  }
}
{ 'a/': { 'a2.json': { jsonKey: 'jsonValue' } } }

I think the problematic behavior occurs in this line, where the previous value for the path is being overwritten.

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