Привет всем, кто-то пользуется lodash? есть шаблон
{
"test": [<%= _.filter(json.test, _it => _it > 1) %>],
"source": <%= _.result(_.filter(json.source, _it => _it.index > 1), 'index') %>
}
и данные
{
"test": [1,2,3],
"a": 1,
"source" :[{
"name": "aa",
"index" : 1
},
{
"name": "bb",
"index" : 2
},
{
"name": "cc",
"index" : 3
}]
}
можно как-то в _.template чтобы возвращался объект?
А то на шаблоне
"source": <%= _.result(_.filter(json.source, _it => _it.index > 1), 'index') %>
возвращается "source": [Object object], [Object object]