Skip to content

Conversation

hpneo
Copy link

@hpneo hpneo commented Jun 21, 2019

This PR adds support to generate an array when indices are used as part of the key path.

For example: 'nested.state.0.key' creates this state: {nested: {state: [{key: 'newValue'}]}}.

Old gzip size: 311B
New gzip size: 337B (+26B)

@hpneo
Copy link
Author

hpneo commented Jun 29, 2020

Hi @developit what do you think about this PR?

@developit
Copy link
Owner

Hiya! Sorry for the delay here - I'm actually not sure about this one, since numeric properties are supported on objects it feels a little unsafe to infer arrays.

@hpneo
Copy link
Author

hpneo commented Nov 11, 2020

Got it. How about nested.state.0.key for numeric properties and nested.state.[0].key for arrays?

@developit
Copy link
Owner

Arrays are just objects with numeric properties though - you can already use nested.state.0.key to access array indices.

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

Successfully merging this pull request may close these issues.

2 participants