linkstate
linkstate copied to clipboard
Add support for array indices in key path
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)
Hi @developit what do you think about this PR?
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.
Got it. How about nested.state.0.key
for numeric properties and nested.state.[0].key
for arrays?
Arrays are just objects with numeric properties though - you can already use nested.state.0.key
to access array indices.