JSFiddle - React, Tailwind, and code Playground

by thefourtheye

HTML

<div id="div1" />

JavaScript

var currentState = [{
    "module": "module1",
        "customUrl": [{
        "mod1": ["1", "2"]
    }, {
        "mod2": ["1", "2"]
    }]
}, {
    "module": "module2",
        "customUrl": [{
        "mod3": ["true", "false"]
    }, {
        "mod4": ["5", "6"]
    }]
}];

document.getElementById('div1').innerHTML = _.chain(currentState)
    .findWhere({
    module: 'module1'
})
    .result('customUrl')
    .find(function (v) {
    return v.hasOwnProperty("mod1")
})
    .values()
    .flatten()
    .tap(console.log.bind(console))
    .value();