src/util/astUtil.js
function collectParameterValues(node) {
    switch (node && node.type) {
        case 'Identifier':
            return [node.name]
        case 'ObjectPattern':
            return _.flatMap(node.properties, prop => collectParameterValues(prop.value))
        case 'ArrayPattern':
            return _.flatMap(node.elements, collectParameterValues)
        default:
            return []
    }
}
function collectParameterValues(node) {
    switch (node && node.type) {
        case 'Identifier':
            return [node.name]
        case 'ObjectPattern':
            return _.flatMap(node.properties, prop => collectParameterValues(prop.value))
        case 'ArrayPattern':
            return _.flatMap(node.elements, collectParameterValues)
        default:
            return []
    }
}
function collectParameterValues ( node ) { switch ( node && node . type ) { case 'Identifier' : return [ node . name ] case 'ObjectPattern' : return _ . flatMap ( node . properties , prop => collectParameterValues ( prop . value ) ) case 'ArrayPattern' : return _ . flatMap ( node . elements , collectParameterValues ) default : return [ ] } }
Returns an array of identifier names returned in a parameter or variable definition
@param node an AST node which is a parameter or variable declaration
@returns {string[]} List of names defined in the parameter
Returns an array of identifier names returned in a parameter or variable definition