Skip to content
New issue

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

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

Already on GitHub? # to your account

babel-plugin-transform-property-literals breaks 0 padded property names #464

Closed
GabbeV opened this issue Mar 8, 2017 · 3 comments
Closed
Labels
bug Confirmed bug has PR Has an open PR that fixes this issue

Comments

@GabbeV
Copy link

GabbeV commented Mar 8, 2017

I have an api that gives me an object like this:

data = {
  "00": { ... },
  "01": { ... },
  "02": { ... }
  `...`
}

When accessing data["00"] babili convets it to data[0] breaking the code.

@hzoo
Copy link
Member

hzoo commented Mar 8, 2017

Hey @GabbeV! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@boopathi
Copy link
Member

boopathi commented Mar 8, 2017

You can use

properties: {
  memberExpression: false,
  propertyLiterals: false,
}

as your babili options

or you can pass

properties: false

in your options.

@GabbeV
Copy link
Author

GabbeV commented Mar 8, 2017

Thank you @boopathi, that works great for a temporary fix. I would still consider it a bug though as it should be avoidable by checking if the numeric strings are 0 padded.

@boopathi boopathi added the bug Confirmed bug label Mar 8, 2017
boopathi added a commit that referenced this issue Mar 8, 2017
@boopathi boopathi added the has PR Has an open PR that fixes this issue label Mar 8, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Confirmed bug has PR Has an open PR that fixes this issue
Projects
None yet
Development

No branches or pull requests

3 participants