0
私はこのlodash()
var data = {
'app.state1': {
some: {...},
sequences: [
{...},
{...},
{...}
]
},
'app.state2': {
some: {...},
sequences: [
{...},
{...}
]
}
};
のようなデータ構造を持っていると私は私がこの
ようにそれを達成しようとしたdata['app.state1']
のインデックス0
でsequences
を取得したいです
var seq = _.get(data,
'data[' + currentState + '].sequences[' + currentSequence +']');
またはこの
var seq = _.get(data,
'data[\'' + currentState + '\'].sequences[' + currentSequence +']');
01のような
両方がうまくいかない... currentState
の中にドットが入った文字列(app.state1
またはapp.state1.substate2
など)があると思われる問題。どんな考え?あなたはずっとに結合
グレート!私は 'path'が配列である可能性があることを忘れてしまった。ありがとう! –